This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author falsetru
Recipients falsetru
Date 2009-06-20.15:14:10
SpamBayes Score 0.000225542
Marked as misclassified No
Message-id <1245510852.42.0.472417043973.issue6316@psf.upfronthosting.co.za>
In-reply-to
Content
format(datetime_obj, format_string) return format_string. (when
format_string is not empty.)


>>> import datetime
>>> d = datetime.datetime.now()
>>> format(d)
'2009-06-20 23:51:54.243428'
>>> format(d, '')
'2009-06-20 23:51:54.243428'
>>> d
datetime.datetime(2009, 6, 20, 23, 51, 54, 243428)
>>> '{0}'.format(d)
'2009-06-20 23:51:54.243428'
>>> '{0:30}'.format(d) # odd
'30'
>>> format(d, '30') # odd
'30'
>>> format(str(d), '30') # workaround
'2009-06-20 23:51:54.243428    '
>>> '{0!s:30}'.format(d) # workaround
'2009-06-20 23:51:54.243428    '
History
Date User Action Args
2009-06-20 15:14:12falsetrusetrecipients: + falsetru
2009-06-20 15:14:12falsetrusetmessageid: <1245510852.42.0.472417043973.issue6316@psf.upfronthosting.co.za>
2009-06-20 15:14:11falsetrulinkissue6316 messages
2009-06-20 15:14:10falsetrucreate