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 p-ganssle
Recipients Alexander Bolshakov, SilentGhost, belopolsky, p-ganssle, xtreak
Date 2020-03-26.21:11:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1585257080.76.0.796374349747.issue40076@roundup.psfhosted.org>
In-reply-to
Content
> isoformat function does not conform to the ISO 8601 and drops microseconds part if its value is 000000.

I'm not sure why you think that this does not conform to ISO 8601 - ISO 8601 is a sprawling beast of a spec and allows some crazy formats. Some examples of perfectly valid ISO 8601 strings:

--03-26
2020-W13-4T03
2020-03-26T03.5
2020-03-26T03,5
2020-03-26T03:30:40.334


There are *hundreds* of valid formats encompassed by ISO 8601.

Anyway, that's an aside. The behavior of .isoformat() is pretty clearly documented. These are the first three line of the documentation:

    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

I believe Karthikeyan has adequately explained how to get the behavior you want, so I am going to go ahead and close this as working as intended.
History
Date User Action Args
2020-03-26 21:11:20p-gansslesetrecipients: + p-ganssle, belopolsky, SilentGhost, xtreak, Alexander Bolshakov
2020-03-26 21:11:20p-gansslesetmessageid: <1585257080.76.0.796374349747.issue40076@roundup.psfhosted.org>
2020-03-26 21:11:20p-gansslelinkissue40076 messages
2020-03-26 21:11:20p-gansslecreate