关于asp中转化时间为数字、字符串

来源:百度知道 编辑:UC知道 时间:2024/06/21 14:52:01
asp中我想取时间如2009-8-4 16:03:04中数字,但用cstr函数或别的转化后都是2009841634,请问怎样才能使其变为“200984160304”?也就是时间中数字小于10时也显示两位。高手讲解一下,谢谢~~~
我是要转化时间为字符串!!!

<%
str=now
str=replace(str," ","")
str=replace(str,"-","")
str=replace(str,":","")
str=replace(str,"上午","")
str=replace(str,"下午","")
response.write str
%>

'***************************************************
'函 数 名:getYYYYMMDDHHIISS
'作 用:根据给定的日期和时间型数据将其转换为YYYYMMDDHHIISS字符串格式
'参 数:d 日期型数据,t 时间型数据
'返 回 值:转换后的字符串
'***************************************************
Function GetYYYYMMDDHHIISS(d,t)

YYYY=Year(d)
MM=Month(d)
DD=Day(d)
HH=Hour(t)
II=Minute(t)
SS=Second(t)
If Len(YYYY) =2 then
YYYY="20" & YYYY
End If
If Len(MM)=1 then
MM="0" & MM
End If
If Len(DD)=1 then
DD="0" & DD
End If
If Len(HH)=1 then
HH="0" &