[issue1074462] Irregular behavior of datetime.__str__()
Skip Montanaro
report at bugs.python.org
Mon Oct 15 15:47:39 CEST 2007
Skip Montanaro added the comment:
Zooko> I meant that it special-cases .microseconds == 0.
Tim indicated in his comment that the behavior is both by design and
documented and isn't going to change. In an earlier comment I showed how to
achieve the result you ased for in one line. Here's another example using
your desire for millisecond display resolution:
>>> dt.replace(microsecond=0).strftime("%Y-%m-%dT%H:%M:%S") + ".%03dZ" % (dt.microsecond//1000)
'2007-10-15T08:24:02.509Z'
Also, I have a patch for py3k which adds a %f format specifier to strftime.
I still have to make some other additions, but you're more than welcome to
review what's there now:
http://bugs.python.org/issue1158
Skip
_____________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1074462>
_____________________________________
More information about the Python-bugs-list
mailing list