php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36531 date() prints the wrong hour seemingly randomly
Submitted: 2006-02-25 22:38 UTC Modified: 2006-03-08 01:00 UTC
Votes:5
Avg. Score:4.0 ± 1.5
Reproduced:4 of 5 (80.0%)
Same Version:1 (25.0%)
Same OS:2 (50.0%)
From: tehughes at wisc dot edu Assigned:
Status: No Feedback Package: Date/time related
PHP Version: 4.4.2 OS: linux
Private report: No CVE-ID: None
 [2006-02-25 22:38 UTC] tehughes at wisc dot edu
Description:
------------
date("g",x) where x is some int literal will print out 
different things depending on when I load it, either 2 hours 
before or after the actual time. 

Reproduce code:
---------------
echo "[[" . date("g:ia",39600) . "]]";

Expected result:
----------------
At this point I'm actually not sure what the correct time is. 
PHP gives me 4:00am or 6:00am depending on the page load.

I have no idea what could be causing this.

Actual result:
--------------
[[6:00am]]

-- next page load --

[[4:00am]]

-- next page load --

[[4:00am]]

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-26 01:30 UTC] judas dot iscariote at gmail dot com
your problem is not reproducible in latest PHP 5.1.3-dev CVS,apache 2 , linux/amd64.
 [2006-02-28 18:07 UTC] bjori@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

Can't reproduce in 4.4.3-dev
(Should btw. print 12:00pm)
 [2006-02-28 18:12 UTC] tehughes at wisc dot edu
Is there any sort of server configuration that could screw this up?
 [2006-02-28 18:36 UTC] derick@php.net
The only thing that could cause this is when you are playing with the TZ environment variable in your scripts. Try to print out the timezone abbreviation in your script too and see what it does.
 [2006-03-08 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC