Steven D'Aprano <steve+comp.lang.pyt...@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. <URL:https://secure.wikimedia.org/wikipedia/en/wiki/ISO_8601#General_principles> > 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 | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list