note 66928 added to function.gmmktime

From: Date: Thu, 01 Jun 2006 08:21:41 +0000
Subject: note 66928 added to function.gmmktime
Groups: php.notes 
Request: Send a blank email to php-notes+get-112716@lists.php.net to get a copy of this message
For some reasing mktime() refuses to convert timestamps prior to 1969-12-31 20:58:58 (!). Or have i lost my head? If i had it running on a windows box it would make sense, but its linux (2.4.21) PHP Version 4.3.10 Apache/1.3.33 This is the code (that works fine on my php5/debian/same apache-machine: http://leetclocks.com/timestamp_bug.php) <? $timestamp = mktime(0,0,0,5,3,1951); $newstamp = mktime(0, 0, 0, date('m',$timestamp), date('d',$timestamp), date('Y',$timestamp)); echo '<p>Now: '.date('U').' ('.date('Y-m-d G:i:s').')</p>'; echo '<p>1951-05-03: '.$newstamp.' ('.date("Y-m-d G:i:s", $newstamp).')</p>'; echo '<p>'.date("Y-m-d G:i:s", -99999999999).'</p>'; ?> The result: http://altnet.se/timestamp_bug.php ---- Server IP: 129.16.214.50 Probable Submitter: 212.78.195.98 ---- X-Spam-Status: No, hits=3.3 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER, HTML_MESSAGE autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.gmmktime.php Edit -- http://master.php.net/note/edit/66928 Del: integrated -- http://master.php.net/note/delete/66928/integrated Del: useless -- http://master.php.net/note/delete/66928/useless Del: bad code -- http://master.php.net/note/delete/66928/bad+code Del: spam -- http://master.php.net/note/delete/66928/spam Del: non-english -- http://master.php.net/note/delete/66928/non-english Del: in docs -- http://master.php.net/note/delete/66928/in+docs Del: other reasons-- http://master.php.net/note/delete/66928 Reject -- http://master.php.net/note/reject/66928 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#112716) next »