develooper Front page | perl.datetime | Postings from December 2004

Re: ANNOUNCE: DateTime 0.23

Thread Previous | Thread Next
From:
Eugene van der Pijll
Date:
December 10, 2004 08:50
Subject:
Re: ANNOUNCE: DateTime 0.23
Message ID:
20041210165031.GA2782@alva.zevenwouden
Dave Rolsky schreef:
> Anyway, enjoy ...
> 
> 0.23    2004-12-09 (the "oh how I hate leap seconds" release)

Dave, I don't really know how to tell you, but...

    use DateTime;

    print "DateTime $DateTime::VERSION\n";
    $dt = DateTime->new(year => 1997, month => 7, day => 1,
                        hour => 1, minute => 0, second => 0,
                        time_zone => '0100');
    print "$dt local = ";
    $dt->set_time_zone('UTC');
    print "$dt UTC\n";

prints 

    DateTime 0.23
    1997-07-01T01:00:00 local = 1997-07-01T00:00:-01 UTC

The conversion to UTC is 1 second off between (and including) the local
datetimes 1997-07-01T01:00:00 and 1997-07-01T23:59:59, that is, from
the second after a leap second, until the end of the day.

This includes

    $dt = DateTime->new(year => 1997, month => 7, day => 1,
                        hour => 23, minute => 59, second => 59,
                        time_zone => '0100');

which results in

    1997-07-02T00:00:-01 local = 1997-07-01T22:59:58 UTC


Eugene

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About