说明
下面例子利用 FormatDateTime 函数把表达式格式化为长日期型并且把它赋给 MyDateTime:
Function GetCurrentDate
'FormatDateTime 把日期型格式化为长日期型。
GetCurrentDate = FormatDateTime(Date, 1)
End Function
在此基础再去修改:
<%
a="1999-10-1"
if len(trim(a))<>10 then
b=split(a,"-")
if cint(b(1))<9 then
t1="0"&b(1)
else
t1=b(1)
end if
if cint(b(2))<9 then
t2="0"&b(2)
else
t2=b(2)
end if
end if
response.write b(0)&"-"&t1&"-"&t2
%>
<%
Tdate="1999-1-1"
TMonth=month(formatdatetime(Tdate,2))
TDay=day(formatdatetime(Tdate,2))
if TMonth<10 then TMonth="0"&TMonth
if TDay<10 then TDay="0"&TDay