TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How to write timezone friendly django application using MySQL

17 pointsby alexdongalmost 15 years ago

3 comments

IgorPartolaalmost 15 years ago
The basic steps for this are: store everything in UTC, do all arithmetic in UTC, store user's timezone info and convert to that at the last second. Python does not have built-in TZ information so you need pytz installed.
评论 #1457890 未加载
pxlpshralmost 15 years ago
We do it without storing a user's time zone via jQuery and a custom script that converts all UTC time stamps on a page to the local time setting of their computer. This works well for us because we have travelers who use the service through a variety of time zones.<p>The second touch point is our iPhone app, and the SDK has built-in support for converting UTC to the client time.
zokieralmost 15 years ago
"UTC used to be called GMT."<p>Not exactly. iirc UTC is based on atomic clocks while GMT is based on astronomy. The whole time measurement system is quite complex and messy.<p>But in most cases it probably is fair to call UTC and GMT equivalent.
评论 #1457929 未加载
评论 #1458041 未加载