datetime strftime methods require year >= 1900

Andrew Dalke adalke at mindspring.com
Thu Sep 30 01:06:33 CEST 2004


Andrew Dalke wrote:
>  >>> strftime(datetime.date(1850, 8, 2), "%Y/%M/%d was a %A")
> '1850/00/02 was a Friday'

While "%Y/%m/%d was a %A" gives

1850/08/02 was a Friday

> 
> % cal 8 1850
>     August 1850
>  S  M Tu  W Th  F  S
>              1  2  3
>  4  5  6  7  8  9 10
> 11 12 13 14 15 16 17
> 18 19 20 21 22 23 24
> 25 26 27 28 29 30 31

I once played around with an alternate time
format string that allowed

%(2000)/%(12)/%(31) to mean %Y, %m, %d.
%(Jan)/%(January)/%(Mon)/%(Monday) to mean %b/%B/%a/%A

because I forget which name is which.

				Andrew
				dalke at dalkescientific.com




More information about the Python-list mailing list