Warum ist strftime auf > 1899 beschränkt?
Verfasst: Freitag 15. März 2013, 11:37
Hallo,
die Doku sagt
irgendwelche Probleme ein?
mutetella
die Doku sagt
Warum ist das so und handle ich mir damitstrftime() hat geschrieben:The exact range of years for which strftime() works also varies across platforms. Regardless of platform, years before 1900 cannot be used.
Code: Alles auswählen
def strftime_(datetime_obj):
if hasattr(datetime_obj, 'hour'):
template = ('{d.year:=04}{d.month:=02}{d.day:=02}'
'{d.hour:=02}{d.minute:=02}')
else:
template = '{d.year:=04}{d.month:=02}{d.day:=02}'
return template.format(d=datetime_obj)
mutetella