您的位置:首页 > 编程语言 > ASP

asp中获取时间yyyymmddhhmmss格式!

2015-12-01 16:40 459 查看
function day_date()
day_date=now()
day_date=replace(day_date,"-","")
day_date=replace(day_date,":","")
day_date=replace(day_date," ","")

day_date=replace(day_date,"/","")

end function
如果你想得到月日时分秒也全为双位数的格式的话,还要先格式一下,把月日时分秒不为两位数的前面补零
function dtos(num)
dtos=cstr(num)
if len(dtos)<2 then
for i=1 to 2-len(dtos)
dtos="0"&dtos
next
else
dtos=dtos
end if
dtos=cint(dtos)
end function

function day_date()
day_month=dtos(month(now))
day_day=dtos(day(now))
day_hour=dtos(hour(now))
day_minute=dtos(minute(now))
day_second=dtos(second(now))
day_date=cstr(year(now))&cstr(day_month)&cstr(day_day)&cstr(day_day)&cstr(day_hour)&cstr(day_minute)&cstr(day_second)
end function
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  asp 时间格式