timezone - A day without midnight -
there's @ least 1 time zone skips 23:59:59 1:00:00 when "springing forward" dst. know is?
the following gets today's date, fails 1 day year time zones matching above criterion.
$ perl -mdatetime -e'say datetime->today( time_zone => $argv[0] )->ymd;' \ america/new_york 2013-08-28
i need time zone testing purposes. i'm not trying above code work.
there several. common 1 brazil using america/sao_paulo
time zone.
$ perl -mdatetime -e'say datetime->new( year => 2013, month => 10, day => 20, hour => 12, time_zone => "america/sao_paulo")->truncate( => "day" )->ymd;' invalid local time date in time zone: america/sao_paulo
you can around problem switching "floating" tome zone before getting date:
$ perl -mdatetime -e'say datetime->new( year => 2013, month => 10, day => 20, hour => 12, time_zone => "america/sao_paulo") ->set_time_zone("floating") ->truncate( => "day" ) ->ymd;' 2013-10-20
see this documentation.
Comments
Post a Comment