Dear Monks,
I am trying to use Date::Manip to deal with various date
formats.
#!/usr/bin/perl
use Date::Manip;
if ( !defined($ENV{'TZ'}) ) {
print "Tz not set!\n";
$ENV{'TZ'} = "-0800";
}
my $time_zone = $ENV{'TZ'};
my @strings = (
"1999/12/12",
"02-03-01",
"10-13-97",
"2001-11-28"
);
foreach $string ( @strings ) {
my $date = &ParseDate( \$string );
print "string is $string date is $date \n";
}
And here's the output
Tz not set!
string is 1999/12/12 date is 1999121200:00:00
string is 02-03-01 date is 2002030100:00:00
string is 10-13-97 date is
string is 2001-11-28 date is 2001112800:00:00
Here's my questions:
1) why didn't Date::Manip read my mind and know that 02-03-01
should be "the thrid of February 2001"
2) what's wrong with 10-13-97 in the USA it should be
"the thirteenth of October 1997".
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.