php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63967 Date function calculation error
Submitted: 2013-01-11 15:28 UTC Modified: 2013-01-11 15:48 UTC
From: bvb dot bolle at gmail dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.4.10 OS: Windows, Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
5 + 23 = ?
Subscribe to this entry?

 
 [2013-01-11 15:28 UTC] bvb dot bolle at gmail dot com
Description:
------------
Just try this:

<?php echo date("Y-m-d", 2912194800); echo ' '.phpversion(); ?>

it should indicate: Thursday, April 13th 2062, 23:00:00 (GMT)

but...

[System]
[Date Calculated] [PHP Version]

Local Windows Vista
1926-03-08 5.4.0-ZS5.6.0

Server01 (WinServ2012)
1926-03-08 5.4.9-Win64

Server02 (Debian)
2062-04-14 5.3.20

Server03 (Ubuntu)
1926-03-08 5.3.10-1ubuntu3.4

Server04 (WinServ2008R2)
1926-03-08 5.4.9-Win64

Test script:
---------------
<?php echo date("Y-m-d", 2912194800); echo ' '.phpversion(); ?>

Expected result:
----------------
2062-04-14

Actual result:
--------------
1926-03-08

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-01-11 15:48 UTC] derick@php.net
.
 [2013-01-11 15:48 UTC] derick@php.net
-Status: Open +Status: Not a bug
 [2013-01-11 15:48 UTC] derick@php.net
Our Windows port always uses 32bit integers, even on a 64bit platform. The large number doesn't fit into the 32bit integer range so it overflows. You can fix this by doing:

<?php echo date_create("@2912194800")->format("Y-m-d"), phpversion(); ?>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 14:01:35 2024 UTC