in reply to CUT time to EST

Is CUT time local time, or do you want to parse a data/time string and convert it to EST? DateTime provides ways of generating a Date object and manipulating it in various ways that may do what you need.


DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re^2: CUT time to EST
by Anonymous Monk on May 10, 2006 at 02:14 UTC
    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.

      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