43 ms·
Summary: Don't let the title throw you off, UTC is fine. Just be aware that when you convert the UTC time that you store back to local time, the conversion mig
by lucb1e 10y ago
Summary:
Don't let the title throw you off, UTC is fine. Just be aware that when you convert the UTC time that you store back to local time, the conversion might be off depending on where you convert it. If your API is hosted on a server in Amsterdam and your users in Japan, that won't work. If your app is run on a tablet bought a few years ago, it will have an old timezone database. As the article highlights:
> Do date/time transformation on the server side, where you can control it.
- mark-r 10y agoIt's more than that. If the daylight saving laws change in the zone you're interested in, the round trip from local to UTC to local again can be off even if your database is up to date and your timezones are correct. Converting from local to UTC using the old rule then UTC to local with the new rule will really mess you up.
- lucb1e 10y agoThe article offers no solution to that though. > So, you had everything right, but result is wrong. Life is unfair. Deal with it. It mentions a workaround, but not a solution.
- mark-r 10y agoThe solution is right there in the next paragraph. Realize when you need to store local times instead of UTC. There's no cookie cutter solution, you need to think about your particular problem and do what's best.