How to check if the summer time shift is?

The CMS that I use allows me to access the time offset of the user from the time UTC / GMT. So, if the user set their time zone for EST, then this offset will be "-5."

What I am doing right now when I need to display the current time is something like:

date('M j Y h:i A', time() + $offset*3600)

This works except when daylight saving time affects the user and then lags behind by an hour.

So my question is, how can I determine if a given time offset (for example, "-5") should add an hour to it?

+5
source share
3 answers

, , , . , , , , . , PHP DateTimeZone API DST.

. ?

+6

If all you have is “-5,” then you don’t have enough information to make this determination. It would be preferable if you could arrange access to the name of the time zone in which the user is located (for example, "America / New York").

+2
source

All Articles