Ticket #2633: tmp_fix.diff
File tmp_fix.diff, 1.5 KB (added by , 18 years ago) |
---|
-
django/utils/dateformat.py
165 165 def O(self): 166 166 "Difference to Greenwich time in hours; e.g. '+0200'" 167 167 tz = self.timezone.utcoffset(self.data) 168 return "%+03d%02d" % (tz.seconds // 3600, (tz.seconds // 60) % 60) 168 seconds = tz.days * 86400 + tz.seconds 169 return "%+03d%02d" % (seconds // 3600, (seconds // 60) % 60) 169 170 170 171 def r(self): 171 172 "RFC 822 formatted date; e.g. 'Thu, 21 Dec 2000 16:01:07 +0200'" … … 198 199 def U(self): 199 200 "Seconds since the Unix epoch (January 1 1970 00:00:00 GMT)" 200 201 off = self.timezone.utcoffset(self.data) 201 return int(time.mktime(self.data.timetuple())) + off.seconds * 60 202 seconds = off.days * 86400 + off.seconds 203 return int(time.mktime(self.data.timetuple())) + seconds * 60 202 204 203 205 def w(self): 204 206 "Day of the week, numeric, i.e. '0' (Sunday) to '6' (Saturday)" … … 249 251 """Time zone offset in seconds (i.e. '-43200' to '43200'). The offset 250 252 for timezones west of UTC is always negative, and for those east of UTC 251 253 is always positive.""" 252 return self.timezone.utcoffset(self.data).seconds 254 off = self.timezone.utcoffset(self.data) 255 return off.days * 86400 + off.seconds 253 256 254 257 def format(value, format_string): 255 258 "Convenience function"