Finding out DST with PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I was hoping someone might be able to help me with something. In a recent 
effort to learn PHP/mySQL, I decided to design a mock forum. Many forums 
(such as phpBB) allow a user to pick their timezone and to select if DST 
should be applied. I'm trying to figure out how its done. Currently, I'm 
saving all times as GMT, having set the default timezone to 'Europe/London'.

I then found this list of timezones:
http://unicode.org/repos/cldr/trunk/docs/design/formatting/zone_log.html#windows_ids

The issue I'm having trouble with now is DST. I just learned that not all 
timezones start DST on the same day, nor do they all add one hour.

According to http://www.php.net/manual/en/datetime.getoffset.php
DateTime::getOffset should give me back the DST offset, but when I have use 
DateTime::setTimezone to change the timezone and get the local users time, 
it automatically applies DST if applicable, and setTimezone gives me 
back -14400 (I'm testing with EST). This is -4 hours, which is the offset 
from GMT to EST right now. Unless I'm using the funciton wrong, it seems to 
give the offset from GMT. Can anyone lend me a thought? 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux