Raymond Hettinger wrote:
Since the rules for handling missing, inconsistent, or out-of-range tuple fields
are not defined, even that revision has some risk. To future-proof the code,
use strptime() to generate a well-formed time tuple:
strptime('%d-%d-%d' % (y,m,d), '%Y-%m-%d')
(2005, 5, 15, 0, 0, 0, 6, 135, -1)
strftime("%Y-%m-%d", _)
'2005-05-15'
or use datetime.date which only needs y, m, d:
>>> from datetime import date
>>> d=date(2005, 5, 15)
>>> d.strftime("%Y-%m-%d")
'2005-05-15'
Kent
--
http://mail.python.org/mailman/listinfo/python-list