[wellylug] php and new Daylight Savings Time
nic
nic at tymar.com
Tue Oct 2 08:22:02 NZDT 2007
I should have had my coffee before replying.
[nic at sugar ~]$ date;php -r "echo strftime('%Y-%m-%d %H:%M:%S %Z%n');";php --version
Tue Oct 2 08:16:03 NZDT 2007
2007-10-02 07:16:03 NZST
PHP 5.1.2 (cli) (built: Mar 13 2006 08:47:11)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
And for completeness,
[nic at sugar ~]$ zdump -v Pacific/Auckland | egrep '200[78]'
Pacific/Auckland Sat Mar 17 13:59:59 2007 UTC = Sun Mar 18 02:59:59 2007 NZDT isdst=1
gmtoff=46800
Pacific/Auckland Sat Mar 17 14:00:00 2007 UTC = Sun Mar 18 02:00:00 2007 NZST isdst=0
gmtoff=43200
Pacific/Auckland Sat Sep 29 13:59:59 2007 UTC = Sun Sep 30 01:59:59 2007 NZST isdst=0
gmtoff=43200
Pacific/Auckland Sat Sep 29 14:00:00 2007 UTC = Sun Sep 30 03:00:00 2007 NZDT isdst=1
gmtoff=46800
Pacific/Auckland Sat Apr 5 13:59:59 2008 UTC = Sun Apr 6 02:59:59 2008 NZDT isdst=1
gmtoff=46800
Pacific/Auckland Sat Apr 5 14:00:00 2008 UTC = Sun Apr 6 02:00:00 2008 NZST isdst=0
gmtoff=43200
Pacific/Auckland Sat Sep 27 13:59:59 2008 UTC = Sun Sep 28 01:59:59 2008 NZST isdst=0
gmtoff=43200
Pacific/Auckland Sat Sep 27 14:00:00 2008 UTC = Sun Sep 28 03:00:00 2008 NZDT isdst=1
gmtoff=46800
and
[nic at sugar ~]$ zdump -v /etc/localtime | egrep '200[78]'
/etc/localtime Sat Mar 17 13:59:59 2007 UTC = Sun Mar 18 02:59:59 2007 NZDT isdst=1
gmtoff=46800
/etc/localtime Sat Mar 17 14:00:00 2007 UTC = Sun Mar 18 02:00:00 2007 NZST isdst=0
gmtoff=43200
/etc/localtime Sat Sep 29 13:59:59 2007 UTC = Sun Sep 30 01:59:59 2007 NZST isdst=0
gmtoff=43200
/etc/localtime Sat Sep 29 14:00:00 2007 UTC = Sun Sep 30 03:00:00 2007 NZDT isdst=1
gmtoff=46800
/etc/localtime Sat Apr 5 13:59:59 2008 UTC = Sun Apr 6 02:59:59 2008 NZDT isdst=1
gmtoff=46800
/etc/localtime Sat Apr 5 14:00:00 2008 UTC = Sun Apr 6 02:00:00 2008 NZST isdst=0
gmtoff=43200
/etc/localtime Sat Sep 27 13:59:59 2008 UTC = Sun Sep 28 01:59:59 2008 NZST isdst=0
gmtoff=43200
/etc/localtime Sat Sep 27 14:00:00 2008 UTC = Sun Sep 28 03:00:00 2008 NZDT isdst=1
gmtoff=46800
And Python thinks DST flag is on
Nic
Jo Booth wrote:
> On 1/10/2007, at 20:03 , nic wrote:
>
>> Has anyone else hit problems with php's internal timezone magic
>> being broken with the new
>> daylight savings time?
>> I've found this:
>> * Machine time is reported correctly. I've even gone as far as
>> rebooting it.
>> * zdump -v Pacific/Auckland shows the correct daylight savings time.
>> * I've downloaded, compiled, installed the newest php timezonedb.
>> * Timezone reported by phpinfo() set to Pacific/Auckland.
>> BUT:
>> time as reported by strftime('%Y-%m-%d %H:%M:%S') is 1 hour behind
>> real time.
>>
>> Any insights?
>>
>> Cheers
>> Nic C-L
>
>
> Onyx:~ jo$ php -r "echo strftime('%Y-%m-%d %H:%M:%S'); echo date
> ('r');"; date
> 2007-10-01 22:25:28
> Mon, 01 Oct 2007 22:25:28 +1300
> Mon Oct 1 22:25:28 NZDT 2007
>
> Seems all good. What OS/platform/php version are you on?
>
> What does a php -r "echo strftime('%Z');" give? NZDT?
>
> This thread on the nz php users group list may help also
> <http://groups.google.com/group/nzphpug/browse_thread/thread/
> 956d2cc661c19eac/714a11e28d3e63d3#714a11e28d3e63d3>
>
>
More information about the wellylug
mailing list