Edit report at https://bugs.php.net/bug.php?id=52261&edit=1

 ID:                 52261
 Updated by:         requi...@php.net
 Reported by:        n-ishii at chiether dot net
 Summary:            strtotime() worng result when timezome only.
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            Date/time related
 Operating System:   Linux
 PHP Version:        5.3.2
 Block user comment: N
 Private report:     N

 New Comment:

The only thing I see wrong is the dates in the Expected Result. Like, GMDATE 
and 
GMT should be the same time...


Previous Comments:
------------------------------------------------------------------------
[2013-09-17 12:49:11] cmbecker69 at gmx dot de

The actual results are absolutely fine, e.g.

> UTC: 2010-07-06 02:58:03
> JST: 2010-07-06 11:58:03 (UTC +9)

UTC+9 means, add 9 hours to the time expressed as UTC and you 
get the local time (JST).

IMHO this is not a bug.

------------------------------------------------------------------------
[2010-07-06 07:29:54] n-ishii at chiether dot net

sorry mistake posted.
-> (timezone:JST)  time-value on "2010-07-07 01:58:03 JST"

------------------------------------------------------------------------
[2010-07-06 07:24:13] n-ishii at chiether dot net

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"

------------------------------------------------------------------------
[2010-07-06 05:11:40] 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)



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=52261&edit=1

Reply via email to