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 skip.montanaro
Recipients brett.cannon, skip.montanaro, tim.peters, tungwaiyip, zooko
Date 2007-10-15.13:47:39
SpamBayes Score 0.01943981
Marked as misclassified No
Message-id <18195.28531.607046.359408@montanaro.dyndns.org>
In-reply-to <1192453890.31.0.828450425872.issue1074462@psf.upfronthosting.co.za>
Content
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
History
Date User Action Args
2007-10-15 13:47:40skip.montanarosetspambayes_score: 0.0194398 -> 0.01943981
recipients: + skip.montanaro, tim.peters, brett.cannon, zooko, tungwaiyip
2007-10-15 13:47:39skip.montanarolinkissue1074462 messages
2007-10-15 13:47:39skip.montanarocreate