note 102910 added to datetime.createfromformat
| From: | klugg at tlen dot pl | Date: | Mon, 14 Mar 2011 17:52:30 +0000 |
| Subject: | note 102910 added to datetime.createfromformat | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-177861@lists.php.net to get a copy of this message | ||
In order to use a DateTimeZone, don't enter one of the DateTimeZone::Europe, DateTimeZone::Asia
etc. constants, but create a DateTimeZone object with verbal timezone name passed as a string:
<?php
$eventDate = DateTime::createFromFormat('m/d/y h:i', '02/26/11 08:00', new
DateTimeZone('Europe/Warsaw'));
echo date_format($eventDate, 'Y-m-d'); //prints "2011-02-26"
?>
----
Server IP: 85.214.154.209
Probable Submitter: 194.11.254.132
----
Manual Page -- http://www.php.net/manual/en/datetime.createfromformat.php
Edit -- https://master.php.net/note/edit/102910
Del: integrated -- https://master.php.net/note/delete/102910/integrated
Del: useless -- https://master.php.net/note/delete/102910/useless
Del: bad code -- https://master.php.net/note/delete/102910/bad+code
Del: spam -- https://master.php.net/note/delete/102910/spam
Del: non-english -- https://master.php.net/note/delete/102910/non-english
Del: in docs -- https://master.php.net/note/delete/102910/in+docs
Del: other reasons-- https://master.php.net/note/delete/102910
Reject -- https://master.php.net/note/reject/102910
Search -- https://master.php.net/manage/user-notes.php