php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17228 timezone incorrect in date
Submitted: 2002-05-14 19:15 UTC Modified: 2002-09-11 11:06 UTC
From: darron at kewl dot org Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.1.2 OS: solaris 2.7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: darron at kewl dot org
New email:
PHP Version: OS:

 

 [2002-05-14 19:15 UTC] darron at kewl dot org
The following:

print date( "r Z T", time() );
print gmdate( "r Z T", time() );

Gives this output:

Tue, 14 May 2002 22:56:09 +0100 3600 GMT
Tue, 14 May 2002 21:56:09 +0000 0 GMT Standard Time

Comment:

Internally solaris creates an integer named
daylight after localtime() is called if an
alternate time zone is in use.

PHP ignores this and always uses tzname[0]

Quick fix:

diff ext/standard/datetime.c~ ext/standard/datetime.c
256c256,259
<               tname[0] = tzname[0];
---
>               if( daylight )
>                tname[0] = tzname[1];
>               else
>                tname[0] = tzname[0];

After patching the PHP code produces:

Wed, 15 May 2002 00:13:40 +0100 3600 BST
Tue, 14 May 2002 23:13:40 +0000 0 GMT Standard Time

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-14 19:53 UTC] darron at kewl dot org
The quick fix may only be valid for the UK (GMT/BST)

The altzone offset may be a better indicator that GMT
is not the correct local timezone elsewhere.
 [2002-07-04 13:38 UTC] eru@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately your are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

It would be even better, if you could retest with a CVS-snapshot.

Thanks for your help.

 [2002-09-11 11:06 UTC] sniper@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 01:01:30 2024 UTC