|
15 | 15 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
16 | 16 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
17 | 17 | # |
18 | | -# $Id: date.py,v 1.77 2004-11-29 14:32:55 a1s Exp $ |
| 18 | +# $Id: date.py,v 1.77.2.1 2005-01-03 03:06:30 richard Exp $ |
19 | 19 |
|
20 | 20 | """Date, time and time interval handling. |
21 | 21 | """ |
@@ -367,8 +367,14 @@ def pretty(self, format='%d %B %Y'): |
367 | 367 | Note that if the day is zero, and the day appears first in the |
368 | 368 | format, then the day number will be removed from output. |
369 | 369 | ''' |
370 | | - str = time.strftime(format, (self.year, self.month, self.day, |
371 | | - self.hour, self.minute, int(self.second), 0, 0, 0)) |
| 370 | + # Python2.4 strftime() enforces the non-zero-ness of the day-of-year |
| 371 | + # component of the time tuple, so we need to figure it out |
| 372 | + t = (self.year, self.month, self.day, self.hour, self.minute, |
| 373 | + int(self.second), 0, 0, 0) |
| 374 | + t = calendar.timegm(t) |
| 375 | + t = time.gmtime(t) |
| 376 | + str = time.strftime(format, t) |
| 377 | + |
372 | 378 | # handle zero day by removing it |
373 | 379 | if format.startswith('%d') and str[0] == '0': |
374 | 380 | return ' ' + str[1:] |
|
0 commit comments