User:Tobiasco/UTC is the wrong way: Difference between revisions
Jump to navigation
Jump to search
(Created page with "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-z...") |
No edit summary |
||
Line 3: | Line 3: | ||
"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." | "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. | 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 | localtime - utc-offset = utc |
Latest revision as of 2012-07-21T12:45:46
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.