ben+python at benfinney.id.au
Sun Sep 11 01:30:18 EDT 2011
Steven D'Aprano <steve+comp.lang.python at pearwood.info> writes:
> But seriously... 2011-12 is not a proper date
It's valid by ISO 8601. The standard allows any number of parts to be
dropped, from least to most significant, in order to have a value with
deliberately reduced precision.
> Otherwise see the time and datetime modules:
>>> import datetime
>>> text = "2011-12"
>>> datetime.datetime.strptime(text, "%Y-%m")
datetime.datetime(2011, 12, 1, 0, 0)
\ “It's not what you pay a man, but what he costs you that |
`\ counts.” —Will Rogers |
More information about the Python-list