핵심 코드
<%'함수 : 다기능 날짜 서식 기능 : http://jorkin.reallydo.com/article.asp?id=477function 형식 (sdatetime, sreallydo) dim sjorkin sjorkin = getlocale (sdateTime)이면 sdatetime이라면 getlocale () = now () sdateTime = cdate (sdateTime) case ucase (sreallydo &) case 0, 1, 2, 3, 4 formatdate = formatdateMe (sdateTime, sreallydo) case 00을 선택하십시오. FormatDate = FormatDate(sDateTime, YYYY-MM-DD hh:mm:ss) Case 01 FormatDate = FormatDate(sDateTime, YYYYYYYYYYYYYYYY-MM-DD) Case 02 FormatDate = FormatDate(sDateTime, YYYY-MM-DD) Case 03 FormatDate = FormatDate (sdateTime, HH : MM : SS) CASE 04 FormatDate = FormatDate (SDATETIME, HH : MM) CASE ISO8601, Google, Siteemap '// ISO8601 Format, googlesitemap에 일반적으로 사용되며 +08 : 00은 시간대 형식입니다. 형식은 형식입니다 (sdateTime, yyyy-mm-ddthh : mm : ss.000 +08 : 00) 사례 RFC822, RSS, FEED '// rfc822 일반적으로 사용됩니다. RSS의 경우 +0800은 SetLocale (EN-GB) FormatDate = FormatDate (SDATETIME, EW, DD EMM YYYY HH : MM : SS +0800) CASE RND, RAND, RANDOMIZE입니다. '// 무작위 화 문자열 randomize sjorkin = rnd () formatdate = formatdate (sdatetime, yyyymmddhhhmmss) & _ fix ((9 * 10^6-1) * sjorkin) + 10^6 else formatdate = sreallydo formatdate = replare (fampatdate, YYYY, YEAR (SDATETIME)) FormatDate = Replace (FormatDate, DD, Right (0 & Day (SDATETIME), 2)) FormatDate = REPLEC (FormatDate, HH, 오른쪽 (0 및 시간 (SDATETIME), 2)) FormatDate = replace (formatDate, mm, 오른쪽 (0 & minute (sdateTime), 2)) formatdate = replace (formatdate, ss, right (0 & second (sdateTime)) , 2)) formatdate = replace (formatdate, yy, right (sdateMe (sdateTime), 2)) formatdate = replace (formatdate, d, day (sdateTime)) formatdate = replace (formatdate, H, Hour (sdateTime)) formatdate = replace (formatDate, m, minute (sdateTime)) formatDate = replace (formatDate, S, Second (sdateTime))) 인 경우 (1, FormatDate, EW, 1)이면 setLocale (en). -gb) formatdate = replace (formatdate, ew, ucase (WeekdayName (sdateTime, false))) formatdate = replace (formatdate, ew, WeekdayName (주중 (sdateTime), false)) formatdate = replace (formatdate, ew, ucase (주간 이름 (sdateTime), true)) formatdate = replace (formatdate, ew, weekdayname (주중 (sdatetime), true) setlocale (sjorkin) else formatdate = replace (formatdate, w, weekdayname (주중 (sdateTime), false) formatdate = 대체 (formatdate, w, weekdayname (sdateTime), true) inst (1, formatdate, emm, 1)> 0이면 setLocale (en-gb) formatdate = replace (formatdate, emm, monthname (month) (Month). sdateTime), false)) formatdate = replace (formatdate, emm, monthname (month (sdateTime), true)) setLocale (sjorkin) else formatdate = 대체 (FormatDate, mm, right (0 & month (sdateTime), 2)) formatdate = replace (formatdate, m, month (sdateTime)) 끝을 선택하면 functionend function%%를 선택하십시오.
사용법은 다음과 같습니다.
<%'형식 날짜 ISO8601 Format Response.write (FormatDate (2008-03-06 08:03:06, Siteemap))'형식 날짜 RFC822 Format Response.write (FormatDate (2008-03-06 08 : 03 : 06 : 06 : 06 : 06) , rss)) '형식 날짜 to (영어 주, 영어 월/일/yyyy)') 'response.write (formatdate (now (), ew, emm/dd/yyyy))' '는 연간 무작위 숫자를 생성합니다. 월, 일, 시간, 분 및 두 번째 응답 .write (formatdate (now (), rnd))%>
자세한 내용은 다음 관련 기사를 확인하십시오.