|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45081 strtotime incorrectly interprets SGT time zone
Submitted: 2008-05-23 15:39 UTC Modified: 2013-06-12 19:56 UTC
Avg. Score:4.5 ± 0.7
Reproduced:8 of 8 (100.0%)
Same Version:7 (87.5%)
Same OS:5 (62.5%)
From: george dot wright at infimatic dot com Assigned: derick (profile)
Status: Closed Package: Date/time related
PHP Version: 5.2.6 OS: SUSE 10.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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: george dot wright at infimatic dot com
New email:
PHP Version: OS:


 [2008-05-23 15:39 UTC] george dot wright at infimatic dot com
Our server is set up for Asia/Singapore time

OS date command prints:   Fri May 23 22:29:19 SGT 2008

Running the following code should produce the same result since the default timezone is SGT but it doesn't. Updating the file to version 2008.2 (the newest available version) did not fix the problem.

Reproduce code:

print strtotime('2008-05-23 00:00:00 SGT');
print "<br>";
print strtotime('2008-05-23 00:00:00');


Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-23 16:42 UTC]
There is an issue here, but the expected result is:
 [2008-05-23 17:43 UTC] george dot wright at infimatic dot com
Correct, my copy/paste mistake. Ant ETA on a fix?
 [2013-05-30 00:43 UTC] sdf at fake-email-address dot com
Any update on this?

I'm using PHP 5.3.3-7+squeeze15 with timezonedb 2013.3 and SGT is still off by 30 
 [2013-05-30 08:38 UTC] php at synotna dot org
Probable workaround?
 [2013-05-30 23:44 UTC] sdf at fake-email-address dot com
Unfortunately not. The offsets are hard coded into PHP, timezonedb is not used for 
 [2013-05-31 13:46 UTC]
Timezonedb is used for strtotime.
 [2013-06-10 06:57 UTC] sdf at fake-email-address dot com
If only it were..


/* The timezone table. */
const static timelib_tz_lookup_table timelib_timezone_lookup[] = {
#include "timezonemap.h"
	{ NULL, 0, 0, NULL },


	{ "acst",  1, -14400, "America/Porto_Acre"            },
	{ "acst",  1, -14400, "America/Eirunepe"              },
	{ "acst",  1, -14400, "America/Rio_Branco"            },
	{ "acst",  1, -14400, "Brazil/Acre"                   },
	{ "act",   0, -18000, "America/Porto_Acre"            },

etc. All hard coded.
 [2013-06-12 19:56 UTC]
That file is autogenerated from timezonedb, I believe.
 [2013-07-19 08:45 UTC] sdf at fake-email-address dot com
I don't see any evidence of this file being autogenerated. It's included in the 
source distribution. Maybe it's autogenerated at some point by someone, but the 
timezonedb.h that gets included in the build is essentially hard-coded and doesn't 
use the system timezonedb at any point.

If it is autogenerated, maybe it's time for someone to rebuild it and update the 
 [2015-01-19 22:59 UTC]
Automatic comment on behalf of
Log: Fixed bug #45081 (strtotime incorrectly interprets SGT time zone).
 [2015-01-19 22:59 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Oct 30 14:01:24 2020 UTC