Bug #72478 [Opn->Nab]: Wrong Unix Timestamps
| From: | cmb@php.net | Date: | Thu, 23 Jun 2016 15:22:19 +0000 |
| Subject: | Bug #72478 [Opn->Nab]: Wrong Unix Timestamps | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-201810@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72478&edit=1
ID: 72478
Updated by: cmb@php.net
Reported by: deivid dot garcia dot garcia at gmail dot com
Summary: Wrong Unix Timestamps
-Status: Open
+Status: Not a bug
Type: Bug
Package: Date/time related
Operating System: Windows
PHP Version: 7.0.7
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
See <https://3v4l.org/tohfa>; you're comparing an
int with a
string with !==.
Previous Comments:
------------------------------------------------------------------------
[2016-06-23 10:50:57] deivid dot garcia dot garcia at gmail dot com
Description:
------------
The DateTime::createFromFormat method seems to ignore the DateTimeZone parameter.
On the sample script, $t should be
Test script:
---------------
$time = "2016-05-25 09:30:00";
// This is the expected timestamp considering $time is in UTC.
$timestamp = 1464168600;
$format = "Y-m-d H:i:s";
$date = \DateTime::createFromFormat($format, $time, new
\DateTimeZone('America/Tegucigalpa'));
$t = $date->format('U'); //1464190200
if ($t !== $timestamp) {
throw new \Exception('¿??¿?¿');
}
Expected result:
----------------
No exception thrown.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72478&edit=1