Date::Parse is nothing new, but I haven't ever really needed it until recently when I had to sort a bunch of date strings.
The dates I need to play look like Sun, 25 Apr 2004 16:08:05 +0200. Sometimes they have the time zone, sometimes they don't. Often they have a lot of different time zones.
Small matter to Date::Parse::str2time()
use Date::Parse qw(str2time);
my $date = 'Sun, 25 Apr 2004 16:08:05 +0200';
my $epoch_time = str2time( $date );
Once I have the epoch time, it's easy to go back the other way too, using Date::Format, also in the TimeDate package.
--
brian d foy <bdfoy@cpan.org>
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.