convert time
Ben Finney
ben+python at benfinney.id.au
Sun Sep 11 01:30:18 EDT 2011
More information about the Python-list mailing list
Sun Sep 11 01:30:18 EDT 2011
- Previous message (by thread): convert time
- Next message (by thread): convert time
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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. <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
- Previous message (by thread): convert time
- Next message (by thread): convert time
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list