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 xtreak
Recipients Alexander Bolshakov, belopolsky, p-ganssle, xtreak
Date 2020-03-26.16:14:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1585239260.31.0.0638513344466.issue40076@roundup.psfhosted.org>
In-reply-to
Content
Does timespec fulfill this use case to always return microseconds?

https://docs.python.org/3/library/datetime.html#datetime.datetime.isoformat

Return a string representing the date and time in ISO 8601 format:
    YYYY-MM-DDTHH:MM:SS.ffffff, if microsecond is not 0
    YYYY-MM-DDTHH:MM:SS, if microsecond is 0

The optional argument timespec specifies the number of additional components of the time to include (the default is 'auto'). It can be one of the following:

    'auto': Same as 'seconds' if microsecond is 0, same as 'microseconds' otherwise.
    'hours': Include the hour in the two-digit HH format.
    'minutes': Include hour and minute in HH:MM format.
    'seconds': Include hour, minute, and second in HH:MM:SS format.
    'milliseconds': Include full time, but truncate fractional second part to milliseconds. HH:MM:SS.sss format.
    'microseconds': Include full time in HH:MM:SS.ffffff format.



./python
Python 3.9.0a4+ (heads/master:6723e933c4, Mar 21 2020, 06:54:01) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime(1, 1, 1).isoformat(timespec='auto')
'0001-01-01T00:00:00'
>>> datetime.datetime(1, 1, 1).isoformat(timespec='microseconds')
'0001-01-01T00:00:00.000000'
History
Date User Action Args
2020-03-26 16:14:20xtreaksetrecipients: + xtreak, belopolsky, p-ganssle, Alexander Bolshakov
2020-03-26 16:14:20xtreaksetmessageid: <1585239260.31.0.0638513344466.issue40076@roundup.psfhosted.org>
2020-03-26 16:14:20xtreaklinkissue40076 messages
2020-03-26 16:14:20xtreakcreate