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

 ID:               52261
 Comment by:       n-ishii at chiether dot net
 Reported by:      n-ishii at chiether dot net
 Summary:          strtotime() worng result when timezome only.
 Status:           Open
 Type:             Bug
 Package:          Date/time related
 Operating System: Linux
 PHP Version:      5.3.2

 New Comment:

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"


Previous Comments:
------------------------------------------------------------------------
[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 http://bugs.php.net/bug.php?id=52261&edit=1

Reply via email to