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 wangchun
Recipients baloan, christian.heimes, wangchun
Date 2008-10-29.09:53:53
SpamBayes Score 4.2011434e-06
Marked as misclassified No
Message-id <1225274036.26.0.151382551479.issue1982@psf.upfronthosting.co.za>
In-reply-to
Content
Ruby recently added support of millisecond and nanosecond to strftime.

This is their changeset:

http://redmine.ruby-lang.org/repositories/revision/ruby-19?rev=18731

To use the extended strftime, one can do:

>> Time.now.strftime('%Y-%m-%dT%H:%M:%S.%L%z')
.. "2008-10-29T17:46:03.895+0800"

In the current implementation of Python, both datetime and time modules 
have strftime. Like in Ruby, the strftime in datetime module is a 
method. But the strftime in time module is a function, which takes time 
value to be formatted from argument, and which must be a 9-tuple 
returned by gmtime or localtime. No microsecond data in the tuple, 
unfortunately.

I think as the first step we can make datetime.datetime.strftime do 
microsecond. I prefer microsecond to milli- or micro- second because it 
is something from the the system.

The current Ruby implementation use %L or %3N for millisecond, %6N for 
microsecond, and %N or %9N for nanosecond. I am not sure where they came 
from. Hope there can be some widely accepted standard.
History
Date User Action Args
2008-10-29 09:53:56wangchunsetrecipients: + wangchun, christian.heimes, baloan
2008-10-29 09:53:56wangchunsetmessageid: <1225274036.26.0.151382551479.issue1982@psf.upfronthosting.co.za>
2008-10-29 09:53:55wangchunlinkissue1982 messages
2008-10-29 09:53:53wangchuncreate