Rss使用中指定的格式
RFC822
.
我发现了一个函数
this thread
function parseRSSDate(sRSSDate)
' take RFC822-formatted date string and return VBScript date object
' ie: "Fri, 13 Jun 2008 16:33:50 GMT"
dim sDay, sMonthName, sMonthNum, sYear, sHour, sMinute, sSecond
dim oRE, oMatches, oMatch
dim sDate, oDate
set oRE = new regexp
oRE.IgnoreCase = True
oRE.Global = True
oRE.Pattern = "^([A-Za-z]{3}),\s([0-9]{1,2})\s([A-Za-z]{3})\s([0-9]{4})\s([0-9]{2}):([0-9]{2}):([0-9]{2})"
set oMatches = oRE.Execute(sRSSDate)
if oMatches.count > 0 then
set oMatch = oMatches(0)
sDay = oMatch.SubMatches(1)
sMonthName = oMatch.SubMatches(2)
sMonthNum = monthVal(sMonthName)
sYear = oMatch.SubMatches(3)
sHour = oMatch.SubMatches(4)
sMinute = oMatch.SubMatches(5)
sSecond = oMatch.SubMatches(6)
sDate = sMonthNum & "/" & sDay & "/" & sYear
oDate = cDate(sDate)
set oMatch = nothing
end if
set oMatches = nothing
set oRE = nothing
parseRSSDate = oDate
end function
它还调用一个名为monthVal的函数,该函数只返回月份名称的数字:
代码:
function monthVal(sMonthName)
' return month number (1-12) from month name
dim rv
dim aMonths : aMonths = Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
for i = 0 to uBound(aMonths)
if sMonthName = aMonths(i) then rv = i+1
next
monthVal = rv
end function