랭귀지/ASP
[ASP]날짜관련함수
유키공
2017. 12. 22. 14:00
- 윤달 체크
function get_month_lastday(year, mon) dim month_day(12) month_day(1) = 31 month_day(2) = 28 month_day(3) = 31 month_day(4) = 30 month_day(5) = 31 month_day(6) = 30 month_day(7) = 31 month_day(8) = 31 month_day(9) = 30 month_day(10) = 31 month_day(11) = 30 month_day(12) = 31 if mon = 2 and isdate(year & "-" & mon & "29") then get_month_lastday = 29 else get_month_lastday = month_day(mon) end if end function날짜중에 한자리 일 경우 앞에 0 붙이는 함수
Function DatePZeroCheckWord(CheckValue) If Len(trim(CheckValue)) = 1 Then CheckValue= "0" & CheckValue DatePZeroCheckWord = CheckValue Else DatePZeroCheckWord = CheckValue End If End Function날짜 형식 체크
Function CheckDateSpace(CheckValue) If (Len(CheckValue) > 0 and Len(CheckValue) < 10 ) or (Len(CheckValue) > 0 and Not(IsDate(CheckValue))) Then Response.write "" Response.End CheckDateSpace = "" Else CheckDateSpace = CheckValue End If End Function날짜시 - 를 없애는 문자 함수
Function DateMCheckWord(CheckValue) If Len(CheckValue) > 0 Then CheckValue=replace(CheckValue, "-" ,"") DateMCheckWord = CheckValue Else DateMCheckWord = "" End If End Function
날짜시 - 를 생성시키는 문자 함수
Function DatePCheckWord(CheckValue) If Len(Trim(CheckValue)) = 8 Then CheckValue = Left(CheckValue,4)&"-"&mid(CheckValue,5,2)&"-"&mid(CheckValue,7) DatePCheckWord = CheckValue Else DatePCheckWord = "" End If End Function