|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2014-01-15 00:28 UTC] neufeind@php.net
-Package: *General Issues
+Package: Date/time related
[2015-01-22 00:33 UTC] cmbecker69 at gmx dot de
[2015-01-22 01:31 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2015-01-22 01:31 UTC] requinix@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 00:00:01 2025 UTC |
Description: ------------ There is a weird bug in time handling (strtotime and date) functions. You must specify your timezone to perform operations with specified timezone! There was no section to write this, so i put it here: If there is a timezone specified, it should use it to treat this specific date. Possible solution: Verify if the timezone is valid, perform offset calculations and return the date. This way, we would be sure that the date is in the same timezone as specified. Test script: --------------- <?=date('d-m-Y h:i:s',strtotime(date('d-m-Y h:i:s',strtotime('02:07:03 Feb 04, 2013 PST'))." GMT"))."<br>"?> <?date_default_timezone_set('GMT')?> <?=date('d-m-Y h:i:s',strtotime(date('d-m-Y h:i:s',strtotime('02:07:03 Feb 04, 2013 PST'))." GMT"));?> <?=date_default_timezone_get()?> Expected result: ---------------- 04-02-2013 10:07:03 04-02-2013 10:07:03 GMT Actual result: -------------- 04-02-2013 12:07:03 04-02-2013 10:07:03 GMT