网站地图    收藏   

主页 > 前端 > css教程 >

修正KingCms的Rss日期格式错误 - html/css语言栏目:

来源:自学PHP网    时间:2015-04-14 14:51 作者: 阅读:

[导读] kingcms生成的Rss文件的日期格式是用now()函数生成的,不符合Rss的书写规范,可以用下面的函数把asp的日期格式转换为Rss支持的日期格式:#39;时间转换函数,符合rfc822标准Private Function ret...

 

kingcms生成的Rss文件的日期格式是用now()函数生成的,不符合Rss的书写规范,可以用下面的函数把asp的日期格式转换为Rss支持的日期格式:

'时间转换函数,符合rfc822标准
Private Function return_RFC822_Date(byVal myDate, byVal TimeZone)
    Dim myDay, myDays, myMonth, myYear
    Dim myHours, myMinutes, mySeconds
    myDate = CDate(myDate)
    myDay = EnWeekDayName(myDate)
    myDays = Right("00" & Day(myDate),2)
    myMonth = EnMonthName(myDate)
    myYear = Year(myDate)
    myHours = Right("00" & Hour(myDate),2)
    myMinutes = Right("00" & Minute(myDate),2)
    mySeconds = Right("00" & Second(myDate),2)
    return_RFC822_Date = myDay & ", " & _
        myDays & " " & _
        myMonth & " " & _
        myYear & " " & _
        myHours & ":" & _
        myMinutes & ":" & _
        mySeconds & " " & _
        TimeZone
End Function

'星期转换函数
Private Function EnWeekDayName(InputDate)
    Dim Result
    Select Case WeekDay(InputDate,1)
        Case 1 : Result = "Sun"
        Case 2 : Result = "Mon"
        Case 3 : Result = "Tue"
        Case 4 : Result = "Wed"
        Case 5 : Result = "Thu"
        Case 6 : Result = "Fri"
        Case 7 : Result = "Sat"
    End Select
   
    EnWeekDayName = Result
End Function

'月份转换函数
Private Function EnMonthName(InputDate)
    Dim Result
    Select Case Month(InputDate)
        Case 1 : Result = "Jan"
        Case 2 : Result = "Feb"
        Case 3 : Result = "Mar"
        Case 4 : Result = "Apr"
        Case 5 : Result = "May"
        Case 6 : Result = "Jun"
        Case 7 : Result = "Jul"
        Case 8 : Result = "Aug"
        Case 9 : Result = "Sep"
        Case 10 : Result = "Oct"
        Case 11 : Result = "Nov"
        Case 12 : Result = "Dec"
    End Select

    EnMonthName = Result
End Function

MsgBox return_RFC822_Date(Now(), "GMT")

 

摘自:醉卧红尘 空间

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号-1@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com

添加评论