Bug #66790 [Nab]: Convert date 0001-01-01 to unix timestamp
| From: | lampacz at gmail dot com | Date: | Tue, 06 Apr 2021 18:21:40 +0000 |
| Subject: | Bug #66790 [Nab]: Convert date 0001-01-01 to unix timestamp | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-233234@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66790&edit=1
ID: 66790
User updated by: lampacz at gmail dot com
Reported by: lampacz at gmail dot com
Summary: Convert date 0001-01-01 to unix timestamp
Status: Not a bug
Type: Bug
Package: Date/time related
Operating System: Debian
PHP Version: 5.4.25
Block user comment: N
Private report: N
New Comment:
ohh, after 7 years....
Version 7.3+ OK
Previous Comments:
------------------------------------------------------------------------
[2021-04-05 15:42:48] derick@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP --
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php
If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
------------------------------------------------------------------------
[2014-03-26 22:27:34] pedro dot bicudo at tgtconsult dot com dot br
Same code returns different results after php update:
$date=date_create("2014-01-01");echo date_timestamp_get($date);
php 5.3.26 returns 1388534400
php 5.3.28 returns 1388541600
$date=date_create("2014-06-14");echo date_timestamp_get($date);
php 5.3.26 returns 1402704000
php 5.3.28 returns 1402714800
this bug displays one day difference on screen depending on timezone
------------------------------------------------------------------------
[2014-02-27 12:29:07] lampacz at gmail dot com
Description:
------------
strtotime("0001-01-01") returns -62135600400
Bash (date -d '0001-01-01' "+%s") returns -62135600264
Postgres (select extract(epoch from timestamp '0001-01-01');) returns -62135600264
of course 64bit system
Test script:
---------------
echo strtotime("0001-01-01")
Expected result:
----------------
-62135600264
Actual result:
--------------
-62135600400
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66790&edit=1