So I'll take your challenge and say .. I think its working, if you dig into how its intended to work. Using your exact example dataset, I reformatted it for Date::Manip. Some may have other opinions on how to set the date, but this is compact and for me easy to follow:
use strict;
use warnings;
use Date::Manip;
my $dt1 = Date::Manip::Date->new();
my $dt2 = Date::Manip::Date->new();
$dt1->config("setdate","zone,Asia/Tokyo");
$dt2->config("setdate","zone,Asia/Calcutta");
$dt1->parse("20030502T07:53");
$dt2->parse("20030502T05:53");
if ( $dt1->cmp($dt2) ) {
print "dt1 ftw!\n";
} else {
print "dt2 ftw!\n";
}
print $dt1->printf("dt1 %c %Z\n");
$dt1->convert("Asia/Calcutta");
print $dt1->printf("dt1 %c %Z\n");
print $dt2->printf("dt2 %c %Z\n");
Output is:
$ perl ./testdate
dt1 ftw!
dt1 Fri May 2 07:53:00 2003 JST
dt1 Fri May 2 04:23:00 2003 IST
dt2 Fri May 2 05:53:00 2003 IST
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.