Opened 18 years ago
Closed 17 years ago
#2447 closed enhancement (duplicate)
[patch] Experimental time zone support for date and time fields, database backend utilities
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Core (Other) | Version: | |
Severity: | normal | Keywords: | timezone, time zone, UTC |
Cc: | Triage Stage: | Design decision needed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
The attached patch attempts to improve Django's support for time zones.
Specifically, it modifies the date and time fields so that they return str(self.data), which will yield an ISO 8601 formatted date, but with a space separator instead of a T. That format will include a time zone offset using the [+-]HH:MM format if the underlying datetime object is not naive. That format is understood by most databases.
It also modifies the function typecast_timestamp from db.backend.util such that it will try to parse time zone offsets. If no such format is found, it will still produce a non-naive datetime object, set in the current time zone.
Attachments (1)
Change History (5)
by , 18 years ago
Attachment: | [3486] time zone support.diff added |
---|
comment:1 by , 18 years ago
I forgot to mention, it also adds some new date / time format characters, following PHP as much as possible.
comment:2 by , 18 years ago
time.tzset()
is not available for Windows, you'll have to write some error checking around that.
comment:3 by , 18 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Unreviewed → Design decision needed |
Due to comment # the parsing is fairly naive and should be improved
I'll mark as patch needs improvement.
It does look like an interesting patch.
We'd need to run tests across all databases and platforms to see if this has any "interesting" side effects.
comment:4 by , 17 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
This is functionally a duplicate of #2626 (though that one solves the problem in a slightly different way).
Time zone patch