Revision 845
Added by Aaron Marcuse-Kubitza about 13 years ago
lib/dates.py | ||
---|---|---|
9 | 9 |
|
10 | 10 |
def strftime(format, datetime_): |
11 | 11 |
'''datetime.strftime() can't handle years before 1900''' |
12 |
return (datetime_.replace(year=epoch_year, day=1).strftime( |
|
13 |
format.replace('%Y', '%%Y').replace('%d', '%%d')) |
|
14 |
.replace('%Y', str(datetime_.year)).replace('%d', str(datetime_.day))) |
|
12 |
return (datetime_.replace(year=epoch_year, day=1).strftime(format |
|
13 |
.replace('%Y', '%%Y') |
|
14 |
.replace('%d', '%%d') |
|
15 |
) |
|
16 |
.replace('%Y', '%04d' % datetime_.year) |
|
17 |
.replace('%d', '%02d' % datetime_.day) |
|
18 |
) |
Also available in: Unified diff
dates.py: Fixed strftime() to pad years and days with leading zeros as datetime.strftime() does