User:Tobiasco/UTC is the wrong way

From tango.info wiki
Jump to navigation Jump to search

https://docs.djangoproject.com/en/dev/topics/i18n/timezones/

"When support for time zones is enabled, Django stores date and time information in UTC in the database, uses time-zone-aware datetime objects internally, and translates them to the end user’s time zone in templates and forms."

For the conversion between local time and UTC an offset is needed. This offset can change. If date and time information is only stored in UTC then there may be situation where the date and time information for an event may get lost.

localtime - utc-offset = utc
utc + utc-offset = localtime

One cannot convert between them without storing the utc-offset.