in reply to Re: Re: setting TZ causes Date::Manip to report incorrect time
in thread setting TZ causes Date::Manip to report incorrect time

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