날짜 함수 > 소스코드

본문 바로가기
사이트 내 전체검색


회원로그인

소스코드

asp | 날짜 함수

페이지 정보

작성자 100K5 작성일14-02-17 09:42 조회73,417회 댓글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)
 
 
DatePart
- 날짜의 특정 부분을 표시 할 수 있도록 함
- 형식: DatePart(interval,date[,firstdayofweek[,firstdayofyear]]]
예 : 원하는 날짜의 월 만 표시
DatePart("m",DateSerial(2001,9,13))
 
DateAdd
- 날짜를 더하는 함수
- 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))
 
DateDiff
- 두 날짜의 날 수를 구하기
예 : 현재 날짜와 SomeDate 사이에 몇 주가 있는지를 구하기
DateDiff("w",Now,SomeDate)
 
현재날짜와 SomeDate 사이에 몇 일이 있는지를 구하기
Dim sDate
sDate  = CDate("2010-10-01")
strDate = DateDiff("d",date,sDate)
 
weekday
- 요일 확인함
weekdayname
- 요일명 확인함
예 : currentDate = now()
currentId = weekday(currentDate)
currentName = weekdayname(currentId)
response.write "오늘은"& currentName
 
MonthName
- 월명 확인 함
예 : currentId = Month(currdate)
response.write MonthName(currentId)
 

댓글목록

등록된 댓글이 없습니다.


사이트소개 개인정보취급방침 서비스이용약관 Copyright © kkujunhee.net All rights reserved.
상단으로

개인정보관리책임자 : 관리자

모바일 버전으로 보기