id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 2633 django.utils.dateformat.DateFormat.O() returns wrong value mukappa nobody "from django.utils.dateformat {{{ def O(self): ""Difference to Greenwich time in hours; e.g. '+0200'"" tz = self.timezone.utcoffset(self.data) return ""%+03d%02d"" % (tz.seconds // 3600, (tz.seconds // 60) % 60) }}} This is wrong when {{{ tz.days == -1 }}} I think this modified method should work {{{ def O(self): ""Difference to Greenwich time in hours; e.g. '+0200'"" tz = self.timezone.utcoffset(self.data) seconds = (tz.days * 24 * 60 * 60) + tz.seconds return ""%+03d%02d"" % (seconds // 3600, (seconds // 60) % 60) }}} This session demonstrates the bug. {{{ df.O() }}} should output {{{ -0500 }}} not {{{ +1900 }}} {{{ mukappa@xxxx 0 /home/mukappa/src/mysite [1005]$ ./manage.py shell Python 2.3.4 (#1, Feb 22 2005, 04:09:37) [GCC 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)] on linux2 Type ""help"", ""copyright"", ""credits"" or ""license"" for more information. (InteractiveConsole) >>> from datetime import datetime >>> from django.utils.dateformat import DateFormat >>> dt = datetime.now() >>> dt datetime.datetime(2006, 8, 30, 20, 48, 14, 86518) >>> df = DateFormat(dt) >>> df.O() '+1900' >>> df.r() 'Wed, 30 Aug 2006 20:48:14 +1900' >>> mukappa@xxxx 0 /home/mukappa/src/mysite [1005]$ date -R Wed, 30 Aug 2006 20:49:02 -0500 }}}" defect closed Core (Other) dev normal fixed datetime Date Filter wbyoung@… Design decision needed 1 0 1 1 0 0