ASP问题 格式化时间
<scriptrunat="server"language="vbscript">functionDoDateTime(str,nNamedFormat,nLCID)di...
<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 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 ?? 谢谢
不行... 展开
1个回答
展开全部
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
调用...
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
调用...
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询