php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66790 Convert date 0001-01-01 to unix timestamp
Submitted: 2014-02-27 12:29 UTC Modified: -
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: lampacz at gmail dot com Assigned:
Status: Open Package: Date/time related
PHP Version: 5.4.25 OS: Debian
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lampacz at gmail dot com
New email:
PHP Version: OS:

 

 [2014-02-27 12:29 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-03-26 22:27 UTC] 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
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Aug 07 04:01:25 2020 UTC