RFC822 to date format using asp
I try converting RFC822 date format (from rss) into a standard date/time format using asp3.开发者_运维技巧
Thanks
Nice solution - the minutes don't always go into double figures though - you'll need to pad those out if minutes are just one digit (I think CDate removes that zero)
eg.
dim theminutes
...
tempDate = cdate(tempDate)
if Len(Minute(toReturn))=1 then
theminutes = "0" & Minute(toReturn)
else
theminutes = Minute(toReturn)
end if
RFC822_to_date = day(tempDate )&"-"&month(tempDate )&"-"&year(tempDate )&" "&hour(tempDate )&":"&theminutes&":00"
Take a look at the source code of this Classic ASP RSS reader.
There are some funky functions involving the use of JScript, which look like they will work for you.
It looks like you need the VBScript functions parseDate
and newDate
, and the two JScript functions.
function RFC822_to_date (orginalDate )
tempDate = trim(right(orginalDate ,(len(orginalDate )-instr(orginalDate,","))))
tempDate = left(tempDate ,(len(tempDate)-5))
tempDate = cdate(tempDate )
RFC822_to_date = day(tempDate )&"-"&month(tempDate )&"-"&year(tempDate )&" "&hour(tempDate )&":"&minute(tempDate )&":00"
end function
精彩评论