note 101020 added to function.date-default-timezone-set
| From: | Anonymous at osu1 dot php dot net | Date: | Sat, 20 Nov 2010 21:58:56 +0000 |
| Subject: | note 101020 added to function.date-default-timezone-set | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-174229@lists.php.net to get a copy of this message | ||
People complaining that there's no way to set the offset - you are wrong. You can easily set
the offset from GMT (see "Other" in available zones). And since all zones are offset from
GMT it's just easy math with + or - to get that. So if you i.e. want the offset not from GMT
but your timezone, then compute offset of your zone from GMT (say if you in Berlin its +1 now (mind
summer time!)) and then offset for your target zone (i.e NYC is -5) then sum abs! of these values
and set the sign of bigger (abs) value -> total offset from your european zone to NYC is then
abs(-5)+abs(1) = 6 and set "-" as NYC zone absolute value is bigger. So whatever time is
in Berlin, in NYC it's 6hrs earlier. But it's better to do two step calculation and
calculate always from GMT
----
Server IP: 195.114.0.19
Probable Submitter: 89.229.85.3
----
Manual Page -- http://www.php.net/manual/en/function.date-default-timezone-set.php
Edit -- https://master.php.net/note/edit/101020
Del: integrated -- https://master.php.net/note/delete/101020/integrated
Del: useless -- https://master.php.net/note/delete/101020/useless
Del: bad code -- https://master.php.net/note/delete/101020/bad+code
Del: spam -- https://master.php.net/note/delete/101020/spam
Del: non-english -- https://master.php.net/note/delete/101020/non-english
Del: in docs -- https://master.php.net/note/delete/101020/in+docs
Del: other reasons-- https://master.php.net/note/delete/101020
Reject -- https://master.php.net/note/reject/101020
Search -- https://master.php.net/manage/user-notes.php