0

I try converting RFC822 date format (from rss) into a standard date/time format using asp3.

Thanks

casperOne
  • 73,706
  • 19
  • 184
  • 253
user186585
  • 512
  • 1
  • 8
  • 25

3 Answers3

1

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"
0

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.

thirtydot
  • 224,678
  • 48
  • 389
  • 349
  • this using CDATE - but for some reason i can't do cdate on my string private function formatDate(aDate) d = cDate(aDate) formatDate = toUTC(year(d), month(d) - 1, day(d), hour(d), minute(d), second(d)) end function – user186585 Dec 14 '10 at 07:59
0
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 
user186585
  • 512
  • 1
  • 8
  • 25