note 97607 deleted from datetime.settimezone by danielc

From: Date: Sat, 01 May 2010 04:48:31 +0000
Subject: note 97607 deleted from datetime.settimezone by danielc
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-168835@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- 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

« previous php.notes (#168835) next »