From:             php at unfit dot org
Operating system: Linux 2.4.23
PHP version:      4.3.10
PHP Bug Type:     Date/time related
Bug description:  strtotime/date behavior

Description:
------------
Negative timestamps seem to work with the date function but not the
strtotime function.  This occurs on all of the Gentoo Linux boxes I am
running on both kernel version 2.4.23 and 2.4.28.  I am running PHP 4.3.10
and Apache/2.0.52.


Reproduce code:
---------------
<?php
  echo date("m/d/Y H:i:s", -2145888000)."\n";
  //01/01/1902 00:00:00

  echo strtotime("Jan 1 1902")."\n";
  //-1

  echo date("m/d/Y H:i:s", -631123200)."\n";
  //01/01/1950 00:00:00

  echo strtotime("Jan 1 1950")."\n";
  //-1

  echo date("m/d/Y H:i:s", 946713600)."\n";
  //01/01/2000 00:00:00

  echo strtotime("Jan 1 2000")."\n";
  //946713600
?>

Expected result:
----------------
01/01/1902 00:00:00
-2145888000
01/01/1950 00:00:00
-631123200
01/01/2000 00:00:00
946713600


Actual result:
--------------
01/01/1902 00:00:00
-1
01/01/1950 00:00:00
-1
01/01/2000 00:00:00
946713600

-- 
Edit bug report at http://bugs.php.net/?id=32270&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=32270&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=32270&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=32270&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=32270&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=32270&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=32270&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=32270&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=32270&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=32270&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=32270&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=32270&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=32270&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=32270&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=32270&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=32270&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=32270&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=32270&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=32270&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=32270&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=32270&r=mysqlcfg

Reply via email to