在线咨询
QQ咨询
服务热线
服务热线:13125520620
TOP

ASP函数-2个日期格式转换函数 - ASP技术

发布时间:2011-11-12 浏览:4982

将日期格式化为 RFC822 格式

Function DateToRFC822(byVal dtaVal)
 Dim strCurLocale : strCurLocale = GetLocale()
 SetLocale("en-gb")
 dtaVal = CDate(dtaVal)
 DateToRFC822 = WeekdayName(Weekday(dtaVal),True)&", "& _
       Right("0"&Day(dtaVal),2)&" "& _
       MonthName(Month(dtaVal),True)&" "& _
       Year(dtaVal)&" "& _
       Right("0"&Hour(dtaVal),2)&":"& _
       Right("0"&Minute(dtaVal),2)&":"& _
       Right("0"&Second(dtaVal),2)&" "& _
       " +0800"
 SetLocale(strCurLocale)
End Function

类似Gmail的中文日期格式(作者:Loveyuki)

Function DateToStr(DateTime)
    Dim DateD,DateM,DateY
    DateD=Int(Day(Now()))-Int(Day(DateTime))
    DateM=Month(Now())-Month(DateTime)
    DateY=Year(Now())-Year(DateTime)
    If DateD=0 And DateM=0 And DateY=0 Then
        DateTime=Hour(DateTime)&":"&Minute(DateTime)
    ElseIf DateY=0 Then
        DateTime=Month(DateTime)&"月"&Day(DateTime)&"日"
    Else
        DateTime=Year(DateTime)&"-"&Month(DateTime)&"-"&Day(DateTime)
    End If
    DateToStr=DateTime
End Function

TAG
软件定制,软件开发,瀚森HANSEN
0
该内容对我有帮助