mirror of
https://github.com/django/django.git
synced 2025-09-19 00:40:11 +00:00
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
This commit is contained in:
parent
c96c57afad
commit
b984505d13
2 changed files with 10 additions and 4 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue