Virden, Larry W. wrote:
>But how do I turn the user supplied date and time into the time for the
>various timezones, and figure out whether daylight savings time is in
>effect?

DateTime can do this:

        #!/usr/bin/perl

        use warnings;
        use strict;

        use DateTime;
        use DateTime::TimeZone;

        my $dt = DateTime->new(year => 2006, month => 3, day => 13, hour => 13,
                        time_zone => "America/New_York");

        foreach (qw(
                America/New_York America/Los_Angeles America/Denver
                America/Chicago Europe/Zurich Europe/London Asia/Jerusalem
                Asia/Tokyo Europe/Moscow Australia/Melbourne
        )) {
                my $tz = DateTime::TimeZone->new(name => $_);
                $dt->set_time_zone($tz);
                print $dt->iso8601, " ", $_, " (",
                        $tz->is_dst_for_datetime($dt) ? "DST" : "std",
                        ")\n";
        }

-zefram

Reply via email to