반응형

ASP 날짜, 시간 - date(), Now(), time()

 

    now_a = Now()
    now_b = Left(Now(), 10)
    now_c = Mid(Date(),1,4) & Mid(Date(),6,2) & Mid(Date(),9,2) & left(FormatDateTime(Now(), 4),2)

                right(FormatDateTime(Now(), 4),2) & right(FormatDateTime(Now(), 3),2)


    response.write " now_a = "& now_a
    response.write " now_b = "& now_b
    response.write "<br> now_c = "& now_c

 

 

Now() ==> 2009-07-09 오후 4:48:49
Date() ==> 2009-07-09
Time() ==> 오후 4:48:49

FormatDateTime(Now(), 0) ==> 2009-07-09 오후 4:48:49
FormatDateTime(Now(), 1) ==> 2009년 7월 9일 목요일
FormatDateTime(Now(), 2) ==> 2009-07-09
FormatDateTime(Now(), 3) ==> 오후 4:48:49
FormatDateTime(Now(), 4) ==> 16:48

 

* YYYY-MM-DD HH24:MI:SS (오라클 기준)
FormatDateTime(Now(), 2) ==> 2009-07-09
FormatDateTime(Now(), 4) ==> 16:48
Right(Now(), 3) ==> :49
====> 2009-07-09 16:48:49

 

Left(Date(), 4) ==> 2009 (년)
Mid(Date(), 6, 2) ==> 07 (월)
Int(Mid(Date(), 6, 2)) ==> 7 (월)

반응형

+ Recent posts