note 124160 added to datetime.createfromformat

From: Date: Sun, 01 Sep 2019 21:46:34 +0000
Subject: note 124160 added to datetime.createfromformat
Groups: php.notes 
Request: Send a blank email to php-notes+get-212085@lists.php.net to get a copy of this message
Be aware: If the day of the month is not provided, creating a DateTime object will produce different results depending on what the current day of the year is. This is because the current system date will be used where values are not provided. <?php function printMonth($month) { echo DateTime::createFromFormat("F", "April")->format("F"); } // on August 1st printMonth("April"); // outputs April // on August 31st printMonth("April"); // outputs May ?> ---- Server IP: 208.43.231.9 Probable Submitter: 82.199.157.54 (proxied: 50.247.42.100) ---- Manual Page -- http://php.net/manual/en/datetime.createfromformat.php Edit -- https://master.php.net/note/edit/124160 Del: integrated -- https://master.php.net/note/delete/124160/integrated Del: useless -- https://master.php.net/note/delete/124160/useless Del: bad code -- https://master.php.net/note/delete/124160/bad+code Del: spam -- https://master.php.net/note/delete/124160/spam Del: non-english -- https://master.php.net/note/delete/124160/non-english Del: in docs -- https://master.php.net/note/delete/124160/in+docs Del: other reasons-- https://master.php.net/note/delete/124160 Reject -- https://master.php.net/note/reject/124160 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#212085) next »