加入收藏 | 设为首页 | 会员中心 | 我要投稿 银川站长网 (https://www.0951zz.com/)- 云通信、基础存储、云上网络、机器学习、视觉智能!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

ASP函数-2个日期格式改变函数

发布时间:2023-03-27 13:27:10 所属栏目:Asp教程 来源:
导读:将日期格式化为 RFC822 格式Function DateToRFC822(byVal dtaVal) Dim strCurLocale : strCurLocale = GetLocale() SetLocale("en-gb") dtaVal = CDate(dtaVal) DateToRFC822 = WeekdayName(Weekday(dtaVal),True)&"

将日期格式化为 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

(编辑:银川站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章