asp格式化日期字符串输出

2025-01-06 19:40:41
推荐回答(1个)
回答1:

<%
'自定义函数
Function GMTtime(a,b,c)

Dim xx2wVar,xx2wToWeek, xx2wToMonth
xx2wVar = a & "-" & b & "-" & c
If Not IsDate( xx2wVar ) Then
xx2wVar = Now
Else
xx2wVar = CDate( xx2wVar )
End If
xx2wToWeek = Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
xx2wToMonth = Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
GMTtime = xx2wToWeek( Weekday( xx2wVar ) - 1 ) &" "&right( xx2wAs & Day( xx2wVar ), 2 ) &"-"&xx2wToMonth( Month( xx2wVar ) - 1 ) &"-"&Year( xx2wVar )
End Function

'使用方法

response.write GMTtime(2009,5,13)
%>