in reply to Re: CUT time to EST
in thread CUT time to EST

I want to parse a date/time string into EST. For example localtime() shows the CUT time which is 4 hours ahead of the EST. I want to remove the 4 hours from the localtime $hours and show the present time.

Replies are listed 'Best First'.
Re^3: CUT time to EST
by GrandFather (Saint) on May 10, 2006 at 10:15 UTC

    The following code uses Date::Manip to parse a time and adjust it from AKST (Alaska Standard) to EST:

    use strict; use warnings; use Date::Manip; Date_Init ("TZ=PST"); # May not be needed and timezone irrelevant my $now = Date_ConvTZ (ParseDate ('00:00:00'), 'AKST', 'EST'); print UnixDate ($now, '%H:%M:%S');

    Prints:

    04:00:00

    DWIM is Perl's answer to Gödel