Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to get RFC822 date format via PERL

Status
Not open for further replies.

gchen

Programmer
Nov 14, 2002
174
US
Folks,

I have a blog written in PERL. One of the blog's function is to generate a RSS/XML feed for RSS reader. But the <pubDate> I got is not accepted by RSS validator which requies RFC822 format.

What I have from my PERL is like this...
<pubDate>02/13/2006 - 11:38</pubDate>

and an RFC822 format is like this...
<pubDate>Wed, 02 Oct 2002 08:00:00 EST</pubDate>
or
<pubDate>Wed, 02 Oct 2002 15:00:00 +0200</pubDate>

any tip?

Thanks a million!

Gary
 
Using one of the date modules on convert the date to epoch time, and then just use the localtime() function

HTH
--Paul

Date::Calc, HTTP::Date should be what you're looking for

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
since 11:38 is not deisgnated AM or PM you will never know what the correct time was. You can just assume it's either one though and go from there. You could also use Time::Local I'm pretty sure to convert the date back to epoch time and then use POSIX (strftime) or localtime() and reformat the date format the way you need it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top