Bug #66903 [Com]: strtotime - diff time zones
Edit report at https://bugs.php.net/bug.php?id=66903&edit=1
ID: 66903
Comment by: a dot dyudyun at gmail dot com
Reported by: a dot dyudyun at gmail dot com
Summary: strtotime - diff time zones
Status: Not a bug
Type: Bug
Package: Date/time related
Operating System: Debian
PHP Version: 5.4.26
Block user comment: N
Private report: N
New Comment:
So strtotime it's function that work with local time zones or with UTC? or with both? It's
problem for me because strtotime("now") and strtotime("now GMT") it's have
some diff
Previous Comments:
------------------------------------------------------------------------
[2014-03-14 07:45:58] requinix@php.net
I take that to mean the Expected and Actual results in the report were backwards?
Not a bug. "Now" is the same everywhere in the world, thus the same timestamp, but
"midnight" most certainly is not.
------------------------------------------------------------------------
[2014-03-14 07:34:48] a dot dyudyun at gmail dot com
About results !!!
=================
Actual result:
----------------
Kiev:1394781415
New-York:1394781415
UTC:1394781415
==========================
Kiev:1394748000
New-York:1394769600
UTC:1394755200
Expected result:
--------------
Kiev:1394781415
New-York:1394781415
UTC:1394781415
==========================
Kiev:1394755200
New-York:1394755200
UTC:1394755200
------------------------------------------------------------------------
[2014-03-14 07:31:38] a dot dyudyun at gmail dot com
Description:
------------
# strtotime() function with param "now" work only with UTC
# time zone (GMT) Grinvich, but param "midnight" work with
# local time zone
Test script:
---------------
<?php
date_default_timezone_set("Europe/Kiev");
echo "Kiev:".strtotime("now");
echo "<br><br>";
date_default_timezone_set("America/New_York");
echo "New-York:".strtotime("now");
echo "<br><br>";
date_default_timezone_set("UTC");
echo "UTC:".strtotime("now");
echo "<br>==========================<br>";
date_default_timezone_set("Europe/Kiev");
echo "Kiev:".strtotime("midnight");
echo "<br><br>";
date_default_timezone_set("America/New_York");
echo "New-York:".strtotime("midnight");
echo "<br><br>";
date_default_timezone_set("UTC");
echo "UTC:".strtotime("midnight");
echo "<br><br>";
?>
Expected result:
----------------
Kiev:1394781415
New-York:1394781415
UTC:1394781415
==========================
Kiev:1394748000
New-York:1394769600
UTC:1394755200
Actual result:
--------------
result:
Kiev:1394781415
New-York:1394781415
UTC:1394781415
==========================
Kiev:1394755200
New-York:1394755200
UTC:1394755200
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66903&edit=1
Thread (7 messages)