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.th
eprojects.org/dev/zone.txt
This may be obvious, but it took me ages to sort out.
Hope this helps someone.
--
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|