function | display | function <%
' Function: Format the display time by the specified parameters.
' Numformat=1: Converts time to YYYY-MM-DD hh:nn format.
' numformat=2: Converts time to YYYY-MM-DD format.
' Numformat=3: Converts time to HH:NN format.
' Numformat=4: Converts the time to yyyy mm month DD Day hh when NN is divided into the format.
' Numformat=5: Converts time to yyyy mm month DD day format.
' numformat=6: NN split format when converting time to HH.
' Numformat=7: Converts the time to the yyyy year mm month DD Day x format.
' Numformat=8: Converts time to YYMMDD format.
' Numformat=9: Converts time to MMDD format.
function FormatDate (Shijian,numformat)
Dim ystr,mstr,dstr,hstr,nstr ' Variable meaning is year string, month string, day string, time string, string
If IsNull (Shijian) Then
Numformat=0
Else
Ystr=datepart ("yyyy", Shijian)
If DatePart ("M", Shijian) >9 Then
Mstr=datepart ("M", Shijian)
Else
Mstr= "0" &datepart ("M", Shijian)
End If
If DatePart ("D", Shijian) >9 Then
Dstr=datepart ("D", Shijian)
Else
Dstr= "0" &datepart ("D", Shijian)
End If
If DatePart ("H", Shijian) >9 Then
Hstr=datepart ("H", Shijian)
Else
Hstr= "0" &datepart ("H", Shijian)
End If
If DatePart ("n", Shijian) >9 Then
Nstr=datepart ("n", Shijian)
Else
Nstr= "0" &datepart ("n", Shijian)
End If
End If
Select Case Numformat
Case 0
Formatdate= ""
Case 1
formatdate=ystr& "-&mstr&"-"&dstr&" "&hstr&": "&nstr
Case 2
formatdate=ystr& "-" &mstr& "-" &dstr
Case 3
formatdate=hstr& ":" &nstr
Case 4
formatdate=ystr& "Year" &mstr& "month" &dstr& "Day" &hstr& "time" &nstr& "cent"
Case 5
formatdate=ystr& "Year" &mstr& "month" &dstr& "Day"
Case 6
formatdate=hstr& "Time" &nstr& "minutes"
Case 7
formatdate=ystr& "Year" &mstr& "month" &dstr& "Day" &weekdayname (Weekday (Shijian))
Case 8
Formatdate=right (ystr,2) &mstr&dstr
Case 9
Formatdate=mstr&dstr
End Select
End Function
%>
Now with asp.net everything is much simpler, or write to commemorate the original use of ASP's years.