4 ms·
UTC is generally a good idea for storing, but there are still some ways to have that bite you. If a user enters a local date time for a future event in a partic
by klysm 2y ago
UTC is generally a good idea for storing, but there are still some ways to have that bite you. If a user enters a local date time for a future event in a particular time zone, converting that to UTC could result in incorrect behavior if the timezone definition changes. It depends on if the user meant that UTC time or if they meant the local time.
- ChrisMarshallNY 2y agoThat's why I do it at the time the query is made. I don't ever store UTC.
- bmicraft 2y ago> if the timezone definition changes Or if DST kicks in/out. No need to have the definitions change.
- klysm 2y agoDepends on how naive the conversion is. If you consider DST while making the conversion that’s not really a problem
- Ndymium 2y agoIt can also cause trouble if you store past events but do not store the user's local offset or timezone at the time of the event. If you aggregate these events later into a dataset of "events by hour", they may be grouped wrong (from a user's perspective) if you convert them all to the user's _current_ timezone.