|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-07-06 05:11 UTC] n-ishii at chiether dot net
Description:
------------
Time Formats: tz format (JST, UTC, GMT, EST...) has problem. maybe wrong (+/-)
Test script:
---------------
[Date]
; Defines the default timezone used by the date functions
date.timezone = "Asia/Tokyo"
<?php
$now = time();
$local = date("Y-m-d H:i:s",$now);
$gmdate = gmdate("Y-m-d H:i:s",$now);
$tz = date_default_timezone_get();
$jst = date("Y-m-d H:i:s", strtotime("JST",$now));
$gmt = date("Y-m-d H:i:s", strtotime("GMT",$now));
$utc = date("Y-m-d H:i:s", strtotime("UTC",$now));
$est = date("Y-m-d H:i:s", strtotime("EST",$now));
$edt = date("Y-m-d H:i:s", strtotime("EDT",$now));
echo "
[TIMEZONE:{$tz}]
DATE: {$local}
GMDATE: {$gmdate}
----
GMT: {$gmt}
UTC: {$utc}
JST: {$jst} (UTC +9)
EDT: {$edt} (UTC -4)
EST: {$est} (UTC -5)
";
Expected result:
----------------
[TIMEZONE:Asia/Tokyo]
DATE: 2010-07-06 11:58:03
GMDATE: 2010-07-06 02:58:03
----
GMT: 2010-07-06 20:58:03
UTC: 2010-07-06 20:58:03
JST: 2010-07-06 11:58:03 (UTC +9)
EDT: 2010-07-07 00:58:03 (UTC -4)
EST: 2010-07-07 01:58:03 (UTC -5)
Actual result:
--------------
[TIMEZONE:Asia/Tokyo]
DATE: 2010-07-06 11:58:03
GMDATE: 2010-07-06 02:58:03
----
GMT: 2010-07-06 02:58:03
UTC: 2010-07-06 02:58:03
JST: 2010-07-06 11:58:03 (UTC +9)
EDT: 2010-07-05 22:58:03 (UTC -4)
EST: 2010-07-05 21:58:03 (UTC -5)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 24 09:00:02 2025 UTC |
or is it design? so example..., EST: 2010-07-05 21:58:03 (-5h) UTC: 2010-07-06 02:58:03 ( 0h) JST: 2010-07-06 11:58:03 (+9h) * local timezone. strtotime("EST"); -> (localdate+EST) "2010-07-06 11:58:03 EST" -> (convert UTC) "2010-07-06 16:58:03 UTC" -> (timezone:JST) time-value on "2010-07-06 01:58:03 JST"