'作用:格式化时间(显示)
'参数:一个是时间,一个是格式化的参数
' 1:"yyyy-mm-dd hh:mm:ss"
' 2:"yyyy-mm-dd"
' 3:"hh:mm:ss"
' 4:"yyyy年mm月dd日"
' 5:"yyyymmdd"
' 6:"yyyymmddhhmmss"
' 7:"yyyymmddhhmm"
' 8:"mm月dd日
' 9:dd日
Function FormatTime(s_Time, n_Flag)
Dim y, m, d, h, mi, s
FormatTime = ""
If IsDate(s_Time) = False Then Exit Function
y = cstr(year(s_Time))
m = cstr(month(s_Time))
If len(m) = 1 Then m = "0" & m
d = cstr(day(s_Time))
If len(d) = 1 Then d = "0" & d
h = cstr(hour(s_Time))
If len(h) = 1 Then h = "0" & h
mi = cstr(minute(s_Time))
If len(mi) = 1 Then mi = "0" & mi
s = cstr(second(s_Time))
If len(s) = 1 Then s = "0" & s
Select Case n_Flag
Case 1
' yyyy-mm-dd hh:mm:ss
FormatTime = y & "-" & m & "-" & d & " " & h & ":" & mi & ":" & s
Case 2
' yyyy-mm-dd
FormatTime = y & "-" & m & "-" & d
Case 3
' hh:mm:ss
FormatTime = h & ":" & mi & ":" & s
Case 4
' yyyy年mm月dd日
FormatTime = y & "年" & m & "月" & d & "日"
case 5
'yyyymmdd
FormatTime= y&m&d
case 6
'yyyymmddhhmmss
FormatTime=y&m&d&h&mi&s
case 7
'yyyymmddhhmm
FormatTime=y&m&d&h&mi
case 8
FormatTime=m & "月" & d & "日"
case 9
FormatTime=d & "日"
case else
FormatTime = s_Time
End Select
End Function
response.write FormatTime("1975/12/22",2)