[issue7789] Issue using datetime with format()

Eric Smith report at bugs.python.org
Tue Jan 26 20:44:02 CET 2010


Eric Smith <eric at trueblade.com> added the comment:

datetime.datetime passes its format string to strftime:

>>> import datetime
>>> x = datetime.datetime(2001, 1, 2, 3, 4)
>>> x.strftime('%Y-%m-%d')
'2001-01-02'
>>> '{0:%Y-%m-%d}'.format(x)
'2001-01-02'

I'll check to make sure this is documented.

----------
assignee:  -> eric.smith
components: +Documentation -Library (Lib)
nosy: +eric.smith
stage: test needed -> 

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7789>
_______________________________________


More information about the Python-bugs-list mailing list