UTC is not a great choice for whole calendar dates such as a date of birth.
My date of birth is 1976-08-27
. Not 1976-08-27T00:00:00Z
.
I currently live in the US Pacific time zone.
My next birthday is from 2016-08-27T00:00:00-07:00
until 2016-08-28T00:00:00-07:00
In UTC, that's equivalent to 2016-08-27T07:00:00Z
until 2016-08-28T07:00:00Z
Of course, if I move to a different time zone before then, I'll celebrate my birthday over a completely different set of ranges.
If I move to Japan, then my birthday will come 16 hours sooner.
My next birthday would be from 2016-08-27T00:00:00+09:00
until 2016-08-28T00:00:00+09:00
In UTC, that's equivalent to 2016-08-26T15:00:00Z
until 2016-08-27T15:00:00Z
Therefore, a date of birth (or anniversary date, hire date, etc.) should be stored as a simple year, month and day. No time, and no time zone.
In MySQL, use the DATE
type. Do not use DATETIME
, TIMESTAMP
or an integer containing Unix time.
Also consider that evaluation of age depends on the time zone where the person is currently located, not the time zone where they were born. If the person's location is unknown to the asker - then it's the asker's time zone that is relevant. "How old are you according to you?" is not necessarily the same as "How old are you according to me?".
Of course, where you live doesn't actually make you older or younger - but it comes down to how we as humans evaluate age in years based on our local calendars. If you were instead to ask "How many minutes old am I?" then answer depends on the instantaneous point in time where you were born - which could be measured in UTC, but will usually be given as a local time and time zone. However, in the common case, one does not usually collect that level of detail.