GhodMode has asked for the wisdom of the Perl Monks concerning the following question:
Is there a way to convert from/to RFC 822 dates without using the DateTime module?
I'm working on a program to process podcast RSS feeds and I'm running into a minor problem with the pubDate element. I want to determine whether or not to download the podcast based on the date that it was published, but all of the feeds publish in different time zones. So, I need to convert the pubDate (formatted per RFC 822) to my local time in order to use it.
One solution involves the DateTime module, but I'd like to avoid additional dependencies, if possible.
Another solution is to just use the shell's date command, which recognizes the RFC 822 date format and can convert it to another format for me.
For example:
This is the solution I'll use if there isn't another option, but it seems like there must be something built into Perl that I'm missing. Thank you.use POSIX 'strftime'; my $pubdate = 'Thu, 11 Jun 2009 11:50:00 PDT'; my $pubdate_here = strftime("%D %T", localtime(`date +"%s" --date="$pu +bdate"`));
-- -- GhodmodeBlessed is he who has found his work; let him ask no other blessedness.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: RFC 822 date manipulation without DateTime module?
by Anonymous Monk on Jun 12, 2009 at 07:02 UTC | |
by GhodMode (Pilgrim) on Jun 12, 2009 at 12:51 UTC | |
by Anonymous Monk on Jun 12, 2009 at 21:41 UTC | |
by GhodMode (Pilgrim) on Jun 15, 2009 at 02:43 UTC | |
|
Re: RFC 822 date manipulation without DateTime module?
by Marshall (Canon) on Jun 12, 2009 at 10:39 UTC | |
by GhodMode (Pilgrim) on Jun 12, 2009 at 12:29 UTC | |
by Marshall (Canon) on Jun 12, 2009 at 13:38 UTC | |
by GhodMode (Pilgrim) on Jun 15, 2009 at 03:01 UTC | |
by ikegami (Patriarch) on Jun 15, 2009 at 03:18 UTC |