note 95610 added to datetime.construct

From: Date: Tue, 12 Jan 2010 16:24:35 +0000
Subject: note 95610 added to datetime.construct
Groups: php.notes 
Request: Send a blank email to php-notes+get-164880@lists.php.net to get a copy of this message
The theoretical limits of the date range seem to be "-9999-01-01" through "9999-12-31" (PHP 5.2.9 on Windows Vista 64): <?php $d = new DateTime("9999-12-31"); $d->format("Y-m-d"); // "9999-12-31" $d = new DateTime("0000-12-31"); $d->format("Y-m-d"); // "0000-12-31" $d = new DateTime("-9999-12-31"); $d->format("Y-m-d"); // "-9999-12-31" ?> Dates above 10000 and below -10000 do not throw errors but produce weird results: <?php $d = new DateTime("10019-01-01"); $d->format("Y-m-d"); // "2009-01-01" $d = new DateTime("10009-01-01"); $d->format("Y-m-d"); // "2009-01-01" $d = new DateTime("-10019-01-01"); $d->format("Y-m-d"); // "2009-01-01" ?> ---- Server IP: 85.214.154.209 Probable Submitter: 173.14.230.129 ---- Manual Page -- http://www.php.net/manual/en/datetime.construct.php Edit -- https://master.php.net/note/edit/95610 Del: integrated -- https://master.php.net/note/delete/95610/integrated Del: useless -- https://master.php.net/note/delete/95610/useless Del: bad code -- https://master.php.net/note/delete/95610/bad+code Del: spam -- https://master.php.net/note/delete/95610/spam Del: non-english -- https://master.php.net/note/delete/95610/non-english Del: in docs -- https://master.php.net/note/delete/95610/in+docs Del: other reasons-- https://master.php.net/note/delete/95610 Reject -- https://master.php.net/note/reject/95610 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#164880) next »