php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39422 Time shifts randomly between GMT and PST
Submitted: 2006-11-08 06:38 UTC Modified: 2006-11-11 04:23 UTC
From: daemonist at guildmail dot sojurn dot org Assigned:
Status: Closed Package: Date/time related
PHP Version: 4CVS-2006-11-08 (CVS) OS: Windows 2003 Server
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: daemonist at guildmail dot sojurn dot org
New email:
PHP Version: OS:

 

 [2006-11-08 06:38 UTC] daemonist at guildmail dot sojurn dot org
Description:
------------
Using Windows 2003 Server, PHP 4.4 (latest CVS as of 2006-11-08) with SMF forums software.

The server date and time are set correctly, and viewing them at the console confirm that.  Sometimes the forums will report the correct time and date, and sometimes the forums will "switch" to the GMT (since the server is in PST, that means +8 hours from the server time).

If I use a simple PHP script to query the date and time, I get the wrong information (so that removes the forums as the cause of this).

If I stop and start IIS, then PHP seems to provide the correct information.  Eventually, however, it will revert back to the erroneous date and time.

I have posted the script code that I used to confirm that PHP is reporting the date and time.

Reproduce code:
---------------
<?php
echo date("F j, Y, g:i a"), '<br />', strftime('%B %d, %Y, %I:%M %p');
?>



Expected result:
----------------
November 7, 2006, 10:35 pm
November 07, 2006, 10:35 PM

Actual result:
--------------
November 8, 2006, 6:35 am
November 08, 2006, 06:35 AM

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-08 13:38 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [2006-11-08 16:35 UTC] daemonist at guildmail dot sojurn dot org
Unfortunately, one of the packages that I am using is not ready for PHP 5 yet, so I'm stuck using PHP 4.

I know that everyone here are volunteers and I really appreciate any help you can give me to get the date to be stable with version 4.

If that isn't possible...  Ooohhh.  I don't want to think of that possibility.

Thanks again for any suggestions you can give!
 [2006-11-08 16:40 UTC] tony2001@php.net
Make sure you don't change TZ environment variable anywhere in your code.
 [2006-11-08 19:38 UTC] daemonist at guildmail dot sojurn dot org
I have checked through the forums software, portal addon, and the two other web pages that use PHP.

I have not found anything that modifies the TZ environment variable.  I wasn't able to find TZ in any of the files at all.

Is there some specific code that I should be looking for?

(sorry for my ignorance here, but my PHP programming is limited)

Thanks again for your suggestions!
 [2006-11-08 19:45 UTC] tony2001@php.net
putenv(), probably.
Though, I wouldn't expect something to change there, since all active development is currently done in PHP6 and PHP5 branches, PHP4 is in maintainance mode for a long time.
 [2006-11-10 22:15 UTC] daemonist at guildmail dot sojurn dot org
Okay, I guess "upgrade to the current version" is a possible solution to this.  :)

Thanks for your help
 [2006-11-11 04:23 UTC] daemonist at guildmail dot sojurn dot org
I will be upgrading to the latest version, and hoping that this corrects the issue.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 06 17:01:34 2024 UTC