29
2020
04

asp日期转时间戳

<%

function getTimeNum(dateStr) '日期转为时间戳

if dateStr<>"" then

getTimeNum=DateDiff("s","1970/01/01",dateStr)

else

getTimeNum=0

end if

end function


function getDateStr(timeNum) '时间戳转为日期

if timeNum<>"" and timeNum<>"0" then

getDateStr=DateAdd("s",timeNum,"1970/01/01")

end if

end function

%>

<%=getTimeNum(now())%>

<br><hr>

<%=getDateStr(1588180954)%>


« 上一篇下一篇 »