Hi,
I'd like to be able to guess the user's timezone offset and whether or not daylight savings is being applied. Currently, the most definitive code that I've found for this is here:
http://www.michaelapproved.com/articles/daylight-saving-time-dst-detect/
So this gives me the offset along with the DST indicator.
Now, I want to use these in my PHP scripts in order to ouput the local date/time for the user....but what's best for this? I figure I have 2 options:
a) Pick a random timezone which has the same offset and DST setting from the output of timezone_abbreviations_list(). Then call date_timezone_set() with this in order to apply the correct treatment to the time.
b) Continue treating the date as UTC but just do some timestamp addition to add the appropriate number of hours on.
My feeling is that option B is the best way. The reason for this is that with A, I could be using a timezone which although correct in terms of offset/dst, may have some obscur rules in place behind the scene that could give surprising results (I don't know of any but nonetheless I don't think I can rule it out).
I'd then re-check the timezone using Javascript at the start of each session in order to capture when either the user's timezone changes (very unlikely) or they pass in to the DST period.
Sorry for the brain dump - I'm really just after some sort of reassurance that the approaches above are valid.
Thanks,
James.