I am using Codeigniter's date helper to obtain the user's timezone offset, [by storing it in a database in mysql]. link
Anyways, all I really have is the offset, since the stored information [in the DB] is customized to CodeIgniter. fore example UM7 is equal to an offset of -7 from GMT.
I get my offset by using timezones($this->session->userdata('timezone'))
, which spits out -7
[or whatever, depending on what the DB stores.].
Anyways, how can I set PHP's own date_default_timezone_set()
to the user's local time?
I can't input numbers in there because i believe that function only allows for strings, like "America/Phoenix"
or something like that. All I have is the offset.
And to make it even more complicated, will PHP automatically detect DST and change accordingly? [because some states in the USA, such as Arizona, does not participate in DST] Thanks!