Dealing with timezones in PHP

I have been looking into how to deal with timezones in PHP and daylight savings. From what I have been able to find, daylight savings in the U.S. takes place from April through October. The only states that do not observe daylight savings are Alaska, Arizona, Hawaii, and Indiana.

To write internationally compliant code I have decided to just include a checkbox that says “Does your local area observe daylight savings?” and if it does have the code during the daylight savings months subtract another hour from the time. This allows the code to be used pretty much anywhere in the world. The only thing I need to look into more is if there is anywhere in the world that falls back two hours. I do not think there is anywhere like that but I need to double check.

Leave a Reply

Your email address will not be published. Required fields are marked *