ASP问题 格式化时间

来源:百度知道 编辑:UC知道 时间:2024/05/25 11:14:11
<script runat="server" language="vbscript">
function DoDateTime(str, nNamedFormat, nLCID)
dim strRet
dim nOldLCID

strRet = str
If (nLCID > -1) Then
oldLCID = Session.LCID
End If

On Error Resume Next

If (nLCID > -1) Then
Session.LCID = nLCID
End If

If ((nLCID < 0) Or (Session.LCID = nLCID)) Then
strRet = FormatDateTime(str, nNamedFormat)
End If

If (nLCID > -1) Then
Session.LCID = oldLCID
End If

DoDateTime = strRet
End Function
</script>

<%=DoDateTime((newsList.Fields.Item("time").Value), 2, -1)%> - <%=DoDateTime((newsList.Fields.Item("time").Value), 3, 1033)%>

显示为 2009-6-1 - 5:38:52 PM

如何能格式化成 Tue, 02 Jun 2009 18:46:23 ?? 谢谢
不行...

function toDate(Datetime)

Datetime=cdate(Datetime)

aYear=year(Datetime) '获得年
aDate=month(Datetime)'获得月
aDay=day(Datetime)'日

dim d(12)'定义一个数组,存英文12月
d(1)="January"
d(2)="Rebruary"
.....
d(12)="December"

aa=d(aDate)&" "&aDay, aYear'得到日期形式
toDate=aa '返回值

end function

调用...