diff --git a/AUTHORS b/AUTHORS index a253e89e8ad..7a4faea5323 100644 --- a/AUTHORS +++ b/AUTHORS @@ -182,6 +182,7 @@ answer newbie questions, and generally made Django that much better: lakin.wecker@gmail.com Nick Lane Stuart Langridge + Paul Lanier Nicola Larosa Eugene Lazutkin Jeong-Min Lee diff --git a/django/utils/dateformat.py b/django/utils/dateformat.py index d5f3499d820..0e6541c721e 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"