note 70821 deleted from function.date by nlopess

From: Date: Mon, 30 Oct 2006 20:13:52 +0000
Subject: note 70821 deleted from function.date by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-119250@lists.php.net to get a copy of this message
Note Submitter: phil at hogarthrange dot com ---- I had date/time stored in a database in GMT and needed to display it according to the users timezone. Including: daylight saving/summer time... Finally found this: <?php putenv("TZ=Australia/Sydney"); $LocalTime = date('d M Y - h:i:s a O ',$GmtTime); print "<p>$LocalTime in:". getenv('TZ')."</p>"; ?> Outputs something like this: 31 Oct 2006 - 05:11:28 pm +1100 in:Australia/Sydney Substitute Australia/Sydney with anything on the list here: http://www.theprojects.org/dev/zone.txt This may be obvious, but it took me ages to sort out. Hope this helps someone.

« previous php.notes (#119250) next »