php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36367 gmmktime() returns GMT offset in wrong direction
Submitted: 2006-02-11 17:05 UTC Modified: 2006-02-12 09:19 UTC
From: geomouchet at yahoo dot com Assigned:
Status: Closed Package: Date/time related
PHP Version: 4.4.2 OS: Linux 2.6.14.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: geomouchet at yahoo dot com
New email:
PHP Version: OS:

 

 [2006-02-11 17:05 UTC] geomouchet at yahoo dot com
Description:
------------
gmmktime() without any parameters returns the wrong time. My time zone is GMT-8, so gmmktime() should be local time PLUS 8 hours.  Instead it returns local time minus 8 hours.  This is different from the DST/summer time problem previously reported.

My expected/actuals results are from a server on Pacific Time, but I also tried this on a web host in Hong Kong (ICDSoft), running PHP 4.4.2 and GMT is similarly offset in the wrong direction from Hong Kong local time.

Reproduce code:
---------------
   echo "<p> PHP version: " . phpversion() . "</p>";
   echo "<p>server time=" . date( "m/d/Y g:i A" )
      . " " . mktime() 
      . "   server GMT=" . date( "m/d/Y g:i A", gmmktime() )
      . " " . gmmktime()
      . "   time zone setting=GMT" . date("O"). "</p>";

Expected result:
----------------
PHP version: 4.4.2

server time=02/11/2006 7:58 AM 1139702295 server GMT=02/11/2006 03:58 PM 1139644695 time zone setting=GMT-0800


Actual result:
--------------
PHP version: 4.4.2

server time=02/11/2006 7:58 AM 1139673495 server GMT=02/10/2006 11:58 PM 1139644695 time zone setting=GMT-0800


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-11 17:09 UTC] tony2001@php.net
Please try using this CVS snapshot:

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


 [2006-02-11 17:32 UTC] geomouchet at yahoo dot com
I don't have my own web server. I'm using PHP at a web host. Can you try it on the latest build with the sample code I provided?
 [2006-02-12 09:19 UTC] sniper@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Sep 19 17:00:01 2025 UTC