note 95834 deleted from function.date by tularis

From: Date: Thu, 09 Feb 2012 20:54:42 +0000
Subject: note 95834 deleted from function.date by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-185977@lists.php.net to get a copy of this message
Note Submitter: robert at extremedesigns dot de ---- if you wish to output a local time, instead of using date_default_timezone_get() and date_default_timezone_set() to manipulate your current timezone, simply create a new DateTime object: <?php $timezone = new DateTimeZone( "Europe/London" ); $date = new DateTime(); $date->setTimezone( $timezone ); echo $date->format( 'H:i:s A / D, M jS, Y' ); ?> -> 22:59:34 PM / Sun, Jan 24th, 2010 Irrespective of current server location, this will output the local time in London, Europe. No need to reset the server timezone back to the previous setting.

« previous php.notes (#185977) next »