note 107171 added to datetime.setdate

From: Date: Thu, 12 Jan 2012 06:59:06 +0000
Subject: note 107171 added to datetime.setdate
Groups: php.notes 
Request: Send a blank email to php-notes+get-185594@lists.php.net to get a copy of this message
Be warned, DateTime::setDate() does not check for invalid input. Illustration: <?php $dt = new DateTime(); $dt->setDate(2012, 11, 31); // returns DateTime object and not false although this date does not exist echo $dt->format('Y-m-d'); // output: 2012-12-01 ?> No error was generated on entering a non existing date, php silently changed it. ---- Server IP: 89.31.146.176 Probable Submitter: 87.88.14.192 ---- Manual Page -- http://www.php.net/manual/en/datetime.setdate.php Edit -- https://master.php.net/note/edit/107171 Del: integrated -- https://master.php.net/note/delete/107171/integrated Del: useless -- https://master.php.net/note/delete/107171/useless Del: bad code -- https://master.php.net/note/delete/107171/bad+code Del: spam -- https://master.php.net/note/delete/107171/spam Del: non-english -- https://master.php.net/note/delete/107171/non-english Del: in docs -- https://master.php.net/note/delete/107171/in+docs Del: other reasons-- https://master.php.net/note/delete/107171 Reject -- https://master.php.net/note/reject/107171 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#185594) next »