

How to write timezone friendly django application using MySQL - alexdong
http://notes.alexdong.com/utc-timezone-daylight-saving-django-and-mysql

======
IgorPartola
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.

~~~
MicahWedemeyer
Storing in UTC goes for all languages, all applications, all realms.

Computer Time = UTC

Think of converting to local timezone as the same as adding commas to a number
to make it look nicer. It's useful for humans but the computer doesn't care.

~~~
IgorPartola
Exactly. I also prefer to store things in a UNIX timestamp. Even with it's
limitations, it's still the easiest way to do time arithmetic.

------
pxlpshr
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.

The second touch point is our iPhone app, and the SDK has built-in support for
converting UTC to the client time.

------
zokier
"UTC used to be called GMT."

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.

But in most cases it probably is fair to call UTC and GMT equivalent.

~~~
alexdong
You're right. UTC is within 0.9 sec from GMT. Nowadays, it seems like GMT and
UTC are two interchangeable names, who'd expect to think they were actually so
difference in terms of how each gets calculated.

