<%
'格式化日期:2001-01-01
function fmtdate(sdate)
dim monstr,daystr
if month(sdate)<10 then
monstr="0" & month(sdate)
else
monstr=month(sdate)
end if
if day(sdate)<10 then
daystr="0" & day(sdate)
else
daystr=day(sdate)
end if
fmtdate=year(sdate) & "-" & monstr & "-" & daystr
end function
'格式化时间:08:01:01
function fmttime(stime)
dim houstr,minstr,secstr
if hour(stime)<10 then
houstr="0" & hour(stime)
else
houstr=hour(stime)
end if
if Minute(stime)<10 then
minstr="0" & Minute(stime)
else
minstr=Minute(stime)
end if
if Second(stime)<10 then
secstr="0" & Second(stime)
else
secstr=Second(stime)
end if
fmttime=houstr & ":" & minstr & ":" & secstr
end function
response.write fmtdate(date) & " " & fmttime(time)
%>
运行结果:
2024-05-28 14:54:30