Edit report at https://bugs.php.net/bug.php?id=60257&edit=1

 ID:                 60257
 Updated by:         [email protected]
 Reported by:        it at ezy2c dot com
 Summary:            ZERO DATES IN STRTOTIME
-Status:             Open
+Status:             Duplicate
 Type:               Bug
 Package:            Date/time related
 Operating System:   CENTOS 5 64 bit
 PHP Version:        5.3.8
 Block user comment: N
 Private report:     N

 New Comment:

Not a bug: on 64 bit platforms, 0000-00-00 00:00:00 is within range, so 
strtotime() returns a UNIX timestamp corresponding to that date. On 32 bit 
platforms, it's out of range, so strtotime() returns NULL to signal the error.

Duplicate of bug #53662 (among others).


Previous Comments:
------------------------------------------------------------------------
[2011-11-11 03:31:33] it at ezy2c dot com

When I strtotime("0000-00-00 00:00:00") in the Linux Box I get -62170020000, 
when I do it on the windows box it returns NULL. Maybe this is the root of the 
issue, at least when it returns NULL it converts to 1970-01-01 10:00:00

------------------------------------------------------------------------
[2011-11-11 03:08:56] it at ezy2c dot com

After a search of the web I have uncovered that other users experience this in 
lots of 5+ versions of PHP on 64-bit *unix OS's. 

If its a 64 bit OS, strtotime should detect if its a ZERO date value (as mysql 
uses as default value etc) ie. 0000-00-00 00:00:00 and return the 1970 value as 
my Windows machine does.

By the way my Windows Machine is a 64-Bit Windows 7 machine with XAMPP, and it 
returns a 1970 date. Please Fix this as we have a LOT of code that relies on 
strtotime's ability.

------------------------------------------------------------------------
[2011-11-10 23:40:19] it at ezy2c dot com

Description:
------------
Hi I have noticed that when i use zero date in windows it converts to the 
expected 1970 date however on our Centos 5 Server it fails.

See live script http://amo2.flsecure.com/testdate.php

Test script:
---------------
EXAMPLE CODE:
$zerodate="0000-00-00 00:00:00";
$convertdate=date("Y-m-d H:i:s",strtotime(0000-00-00 00:00:00));
echo("ORIG: ".$zerodate." | CONVERTED: ".$convertdate.");

RESULT:
ORIG: 0000-00-00 00:00:00 | CONVERTED: -0001-11-30 00:00:00

On MY WINDOWS BOX:
ORIG: 0000-00-00 00:00:00 | CONVERTED: 1970-01-01 10:00:00



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60257&edit=1

Reply via email to