问题
I am writing an app that has a time slot booking system. The users can be in different timezones, thus I need to store the values in the database in UTC time.
I was wondering how UTC_TIMESTAMP()
is calculated in MySQL. Is it reliable?
If the server timezone is in an area with daylight savings will UTC_TIMESTAMP()
always behave correctly, even during time changes due to daylight savings?
回答1:
UTC is always +0:00
- it ignores daylight savings, regardless of whether or not it is in effect.
In the UK, when not on daylight savings, we use GMT (which is the same as UTC). When we're observing daylight savings, we have BST for that.
Wikipeda has this to say on UTC:
UTC does not change with a change of seasons, but local time or civil time may change if a time zone jurisdiction observes daylight saving time (summer time). For example, local time on the east coast of the United States is five hours behind UTC during winter, but four hours behind while daylight saving is observed there.
来源:https://stackoverflow.com/questions/17378476/is-utc-timestamp-affected-by-daylight-savings