note 97607 added to datetime.settimezone
| From: | Anonymous at osu1 dot php dot net | Date: | Wed, 28 Apr 2010 03:33:18 +0000 |
| Subject: | note 97607 added to datetime.settimezone | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-168741@lists.php.net to get a copy of this message | ||
You can use this function to convert from one timezone to another. and avoid using unix timestamps.
<?php
echo phpversion()."\n";
$myDateTime = new DateTime( /* mysql style time */ '2010-01-01 22:07:00' , new
DateTimeZone('America/Chicago') );
echo $myDateTime->format('Y-m-d H:i e O')."\n";
$myDateTime->setTimezone( new DateTimeZone('Europe/London') );
echo $myDateTime->format('Y-m-d H:i e O')."\n";
?>
My output
5.2.3
2010-01-01 22:07 America/Chicago -0600
2010-01-02 04:07 Europe/London +0000
----
Server IP: 69.147.83.197
Probable Submitter: 99.63.7.141
----
Manual Page -- http://www.php.net/manual/en/datetime.settimezone.php
Edit -- https://master.php.net/note/edit/97607
Del: integrated -- https://master.php.net/note/delete/97607/integrated
Del: useless -- https://master.php.net/note/delete/97607/useless
Del: bad code -- https://master.php.net/note/delete/97607/bad+code
Del: spam -- https://master.php.net/note/delete/97607/spam
Del: non-english -- https://master.php.net/note/delete/97607/non-english
Del: in docs -- https://master.php.net/note/delete/97607/in+docs
Del: other reasons-- https://master.php.net/note/delete/97607
Reject -- https://master.php.net/note/reject/97607
Search -- https://master.php.net/manage/user-notes.php