asp | 날짜 함수
페이지 정보
작성자 100K5 작성일14-02-17 09:42 조회74,104회 댓글0건관련링크
본문
DateSerial
- 특정날짜 계산해서 날짜값 구함 (년, 월, 일 별로 계산을 함)
예 :
last_month_first_day = DateSerial(Year(Date),Month(Date) -1, 1 -0) ' 전월 1일 (올해, 금월 - 1, 1일)
last_month_last_day = DateSerial(Year(Date),Month(Date) -0, 1 -1) ' 전월 말일 (올해, 금월, 1일 - 1)
last_month_last_day = DateSerial(Year(Date),Month(Date) -0, 1 -1) ' 전월 말일 (올해, 금월, 1일 - 1)
DatePart
- 날짜의 특정 부분을 표시 할 수 있도록 함
- 형식: DatePart(interval,date[,firstdayofweek[,firstdayofyear]]]
- 형식: DatePart(interval,date[,firstdayofweek[,firstdayofyear]]]
예 : 원하는 날짜의 월 만 표시
DatePart("m",DateSerial(2001,9,13))
DatePart("m",DateSerial(2001,9,13))
DateAdd
- 날짜를 더하는 함수
- DateAdd(interval,number,date) ' 단위, 숫자, 날짜
- DateAdd(interval,number,date) ' 단위, 숫자, 날짜
- 단위
"YYYY" - year
"q" - Quarter
"m" - Month
"d" - Day
"w" - Weekday
"ww" - Week of year
'h' - Hour
"n" - Minute
"s" - Second
예 : 오늘로부터 정확히 1년전 그 주의 요일을 구하기
DatePart("W",DateAdd("Y",-1,Date))
DatePart("W",DateAdd("Y",-1,Date))
DateDiff
- 두 날짜의 날 수를 구하기
예 : 현재 날짜와 SomeDate 사이에 몇 주가 있는지를 구하기
DateDiff("w",Now,SomeDate)
예 : 현재 날짜와 SomeDate 사이에 몇 주가 있는지를 구하기
DateDiff("w",Now,SomeDate)
현재날짜와 SomeDate 사이에 몇 일이 있는지를 구하기
Dim sDate
sDate = CDate("2010-10-01")
strDate = DateDiff("d",date,sDate)
strDate = DateDiff("d",date,sDate)
weekday
- 요일 확인함
weekdayname
- 요일명 확인함
예 : currentDate = now()
예 : currentDate = now()
currentId = weekday(currentDate)
currentName = weekdayname(currentId)
response.write "오늘은"& currentName
MonthName
- 월명 확인 함
예 : currentId = Month(currdate)
예 : currentId = Month(currdate)
response.write MonthName(currentId)
댓글목록
등록된 댓글이 없습니다.