#26571 closed Cleanup/optimization (fixed)
Documentation about usage of fromtimestamp (wrt timezones) is confusing
Reported by: | Torsten Bronger | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.9 |
Severity: | Normal | Keywords: | |
Cc: | bronger@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
On <https://docs.djangoproject.com/en/1.9/topics/i18n/timezones/#default-current-time-zone>, it says:
For instance, use utcfromtimestamp() instead of fromtimestamp()
– and don’t forget to set tzinfo to utc.
But isn't the straightfoward way for getting a timezone-aware UTC object
fromtimestamp(time.time(), utc)
?
Note:
See TracTickets
for help on using tickets.
Indeed, I wasn't aware of the optional second parameter to
fromtimestamp
when I wrote this note.