If, by "something more meaningful" you mean local time, you might want to have a look at
Date::Parse and it's tremendously useful str2time() function. Once you have your date string converted to epoch seconds, you can do all sorts of manipulations to it:
use POSIX qw/strftime/;
use Date::Parse;
$ENV{TZ} = "UTC";
my $utc_date_str = "2003-05-06 02:09:00 UTC";
my $epoch_secs = str2time($utc_date_str);
$ENV{TZ} = "Canada/Atlantic"; # set TZ to local
my $local_date_str = strftime("%Y-%m-%d %T %Z", localtime($epoch_secs)
+ );
$ENV{TZ} = "UTC"; # restore TZ to UTC
print "$local_date_str\n";
--
OUTPUT:
2003-05-05 23:09:00 ADT
You might also want to have a look at the other Date:: modules. Most of them are small and fast (except for Date::Manip :-), and the odds are that no matter what you have to do in terms of date manipulation, there already exists a module to solve your problem (at least in part).
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.