summaryrefslogtreecommitdiff
path: root/django/utils/dateformat.py
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-09-15 10:36:14 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-09-15 10:36:14 +0000
commitb984505d1367da35d38ae3c2a81a610d8657300a (patch)
tree6a3cb138f428736954877fee5518ec38dedba8b0 /django/utils/dateformat.py
parentc96c57afadbab2b3f79e231be64b3576d21313ff (diff)
Fixed #5470 -- Fixed the 'Z' time format marker in templates to handle timezones west of UTC. Thanks, Paul Lanier.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6275 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils/dateformat.py')
-rw-r--r--django/utils/dateformat.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/django/utils/dateformat.py b/django/utils/dateformat.py
index d5f3499d82..0e6541c721 100644
--- a/django/utils/dateformat.py
+++ b/django/utils/dateformat.py
@@ -248,10 +248,15 @@ class DateFormat(TimeFormat):
return doy
def Z(self):
- """Time zone offset in seconds (i.e. '-43200' to '43200'). The offset
- for timezones west of UTC is always negative, and for those east of UTC
- is always positive."""
- return self.timezone.utcoffset(self.data).seconds
+ """
+ Time zone offset in seconds (i.e. '-43200' to '43200'). The offset for
+ timezones west of UTC is always negative, and for those east of UTC is
+ always positive.
+ """
+ offset = self.timezone.utcoffset(self.data)
+ # Only days can be negative, so negative offsets have days=-1 and
+ # seconds positive. Positive offsets have days=0
+ return offset.days * 86400 + offset.seconds
def format(value, format_string):
"Convenience function"