LMPX.COM |
Home | Linux | Mysql | PHP | XML | ||
|
|
|||
From: Dr.Ruud Date: Mon Sep 29 12:10:46 2008 Subject: Re: definition of correctness
deepfryed@gmail.com schreef: >> Probably because the start point of your POSIX calculations are at >> 00:00, and those of your DateTime-calculations are at 02:00? > > That still does not make sense, 00:00 + 26 hrs is same as 00:00 + 27 > hours ? because thats what POSIX::mktime tells me. Your DateTime-calls have "day => 4" where you need "day => 5". The point in time 2008-10-05T02:00:00 doesn't exist there, so you can not set up an object with it. $ perl -MDateTime -le ' print DateTime->new( year => 2008, month => 10, day => 5, hour => 2, time_zone => "Australia/Melbourne", ) ' Invalid local time for date in time zone: Australia/Melbourne I got used to set up your objects at noon, and subtract 12 hours to get to midnight, etc. $ perl -MDateTime -le ' print DateTime->new( year => 2008, month => 10, day => 5, hour => 12, time_zone => "Australia/Melbourne", )->add( hours => -12+2+24, ) ' 2008-10-06T02:00:00 $ perl -MDateTime -le ' print DateTime->new( year => 2008, month => 10, day => 5, hour => 12, time_zone => "Australia/Melbourne", )->add( hours => -12+2+25, ) ' 2008-10-06T03:00:00 $ perl -MDateTime -le ' print DateTime->new( year => 2008, month => 10, day => 5, hour => 12, time_zone => "Australia/Melbourne", )->add( hours => -12+2+48, ) ' 2008-10-07T02:00:00 Don't think you can use 00:00 as a safe point in time to set up an object. (There are timezones that switch DST at midnight, so some midnights don't exist.) -- Affijn, Ruud "Gewoon is een tijger."
| Navigate in group perl.datetime at sever nntp.perl.org | |
| Previous | Next |
| © No Copyright You are free to use Anything |
Site Maintained by PHP Developer
Powered By PHP Consultants |