Bug #63967 [Nab]: Date function calculation error
| From: | derick@php.net | Date: | Fri, 11 Jan 2013 15:48:31 +0000 |
| Subject: | Bug #63967 [Nab]: Date function calculation error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-175957@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63967&edit=1
ID: 63967
Updated by: derick@php.net
Reported by: bvb dot bolle at gmail dot com
Summary: Date function calculation error
Status: Not a bug
Type: Bug
Package: Date/time related
Operating System: Windows, Linux
PHP Version: 5.4.10
Block user comment: N
Private report: N
New Comment:
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();
?>
Previous Comments:
------------------------------------------------------------------------
[2013-01-11 15:48:03] derick@php.net
.
------------------------------------------------------------------------
[2013-01-11 15:28:31] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63967&edit=1