asp教程 格式化时间函数
本款函数可以根据用户给定的时间日期进行年月日时分秒等只要用户给定不同的style参数就可以显示不同风格的时间日期
function formattime(testtimestyle)
dim nyrsfm
n = year(testtime)
y = month(testtime)
r = day(testtime)
s = hour(testtime)
f = minute(testtime)
m = second(testtime)
if len(n) = then n = "" & n
if len(y) = then y = "" & y
if len(r) = then r = "" & r
if len(s) = then s = "" & s
if len(f) = then f = "" & f
if len(m) = then m = "" & m
nn=right(n)
if style = then
formattime = ""& n &"年"& y &"月"& r &"日"& s &"时"
elseif style = then
formattime = r &"日 "& s & ":" & f & ":" & m
elseif style = then
formattime = n &"年"& y &"月"& r &"日"
elseif style = then
formattime = n & "" & y & "" & r & " " & s & ":" & f
elseif style = then
formattime = y &""& r &"" & s & ":" & f
elseif style = then
formattime = n &"年"& y &"月"& r &"日" & s &":"& f
elseif style = then
formattime = n & y & r & s & f & m
elseif style = then
formattime = n & "" & y & "" & r
elseif style = then
formattime = n & "/" & y & "/" & r
end if
end function