Hi,
I am trying to convert UTC (In seconds) time to local Time.
I will appreciate if anybody has some hints to do this.
I have code like this, it does not work properly
Here cds_date is in UTC seconds and $cmpn_date is in local time
Just comparing if both of the same
Thanks,
Bilashi
#check date
sub checkDate () {
my ($cds_date, $cmpn_date, $fhlog, $result) = @_;
my ($g_day, $g_mon, $g_year, $g_hr, $g_min, $g_sec, $g_msec, $g_ampm) =
split(/[-\s\.]/, $cmpn_date); $g_year += 2000;
my @abbr = qw( JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC );
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime($cds_date);
$year += 1900;
if($g_ampm eq "PM") {
$g_hr += 12;
}
$g_hr = 0 if($g_ampm eq "AM" && $g_hr == 12);
$hour = ($hour + 7) if ($g_hr < 17);;
if ($g_year == $year &&
($g_day == $mday) &&
($abbr[$mon] eq $g_mon)
&& $g_hr == $hour && $g_min == $min && $g_sec == $sec) {
#$g_hr == $hour && $g_min == $min && $g_sec == $sec) {
} else {
$$result = "F";
}
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs