List Info

Thread: note 70821 added to function.date




note 70821 added to function.date
user name
2006-10-30 06:46:56
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.
----
Server IP: 203.220.0.234
Probable Submitter: 210.10.221.245
----
Manual Page -- http:/
/www.php.net/manual/en/function.date.php
Edit        -- https://master
.php.net/note/edit/70821
Del: integrated  -- h
ttps://master.php.net/note/delete/70821/integrated
Del: useless     -- http
s://master.php.net/note/delete/70821/useless
Del: bad code    -- htt
ps://master.php.net/note/delete/70821/bad+code
Del: spam        -- https:/
/master.php.net/note/delete/70821/spam
Del: non-english -- 
https://master.php.net/note/delete/70821/non-english
Del: in docs     -- http
s://master.php.net/note/delete/70821/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/70821
Reject      -- https://mast
er.php.net/note/reject/70821
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )