<% ' function: Multifunction date Format function ' Source: http://jorkin.reallydo.com/article.asp?id=477 function FormatDate (sdatetime, Sreallydo) Dim Sjorkin Sjorkin = GetLocale () If not IsDate (sdatetime) Then sdatetime = Now () Sdatetime = CDate (sdatetime) Select case
UCase (Sreallydo & "") case "0", "1", "2", "3", "4" formatdate = FormatDateTime (sdatetime, Sreallydo) case "00"
FormatDate = FormatDate (Sdatetime, "Yyyy-mm-dd hh:mm:ss") case "a" formatdate = FormatDate (Sdatetime, "YYYY year MM month DD Day")
Case "a" formatdate = FormatDate (Sdatetime, "YYYY-MM-DD") case "" FormatDate = FormatDate (Sdatetime, "Hh:mm:ss") Case "a" formatdate = FormatDate (Sdatetime, "hh:mm") case "ISO8601", "GOOGLE", "SITEMAP" '//iso8601 format, generally used for Googlesitem
AP, "+08:00" is the time zone. FormatDate = FormatDate (Sdatetime, "yyyy-mm-ddthh:mm:ss.000+08:00") case "RFC822", "RSS", "feed" '//rfc822 format, generally used for RSS, "
+0800 "is the time zone. SetLocale ("EN-GB") FormatDate = FormatDate (Sdatetime, "Ew, DD eMM YYYY hh:mm:ss +0800") SetLocale (Sjorkin) CasE "RND", "RAND", "RANDOMIZE" '//random string RANDOMIZE Sjorkin = RND () formatdate = FormatDate (Sdatetime, "YYYYMMDDHHMMSS") & _ Fix ((9 * 10^6-1) * Sjorkin) + 10^6 case Else formatdate = Sreallydo formatdate = Replace (FormatDate, "Y YYY ", Year (sdatetime)) FormatDate = replace (formatdate," DD ", Right (" 0 "& Day (Sdatetime), 2)) FormatDate = Replace
(FormatDate, "HH", Right ("0" & Hour (Sdatetime), 2) FormatDate = replace (formatdate, "MM", right ("0" & Minute (Sdatetime), 2)) FormatDate = replace (formatdate, "SS", Rig HT ("0" & Second (Sdatetime), 2)) FormatDate = Replace (formatdate, "YY", Right (year (Sdatetime), 2)) FormatDate = Rep Lace (formatdate, "D", Day (sdatetime)) FormatDate = replace (formatdate, "H", Hour (sdatetime)) FormatDate = replace (Form Atdate, "M", Minute (sdatetime)) FormatDate = Replace (formatdate, "s", Second (sdatetime)) If InStr (1, FormatDate, "EW", 1) > 0 Then SetLocale ("EN-GB") FormatDate = Replace (formatdate, "EW", UCase (WeekDayname (Weekday (sdatetime), false)) FormatDate = Replace (formatdate, "EW", WeekdayName (Weekday (sdatetime), false)) Fo Rmatdate = replace (formatdate, "Ew", UCase (WeekdayName (Weekday (sdatetime), True)) FormatDate = replace (formatdate, "EW" ", WeekdayName (Weekday (sdatetime), True) SetLocale (sjorkin) Else formatdate = Replace (formatdate," W ", WeekdayName ( Weekday (Sdatetime), False)) FormatDate = Replace (FormatDate, "W", WeekdayName (Weekday (sdatetime), True)) End If I NSTR (1, FormatDate, "Emm", 1) > 0 Then SetLocale ("EN-GB") FormatDate = Replace (formatdate, "Emm", MonthName (Month (s DateTime), False) formatdate = Replace (formatdate, "EMM", MonthName (Month (sdatetime), True) SetLocale (Sjorkin) Els E formatdate = replace (formatdate, "MM", Right ("0" & Month (Sdatetime), 2)) FormatDate = replace (FormatDate, "M", M
Onth (Sdatetime)) End-If end Select-end Function%>