-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Description
Documentation
Summary
Add documentation of the %f
field to convert microseconds in the time library.
Details
On this webpage (https://docs.python.org/3.10/library/time.html), the discussion of strptime
and the conversion fields used (%H
for hour, %Y
for year, etc) doesn't include mention of the %f
field to match microseconds. On my system, this is needed to convert back and forth from datetime
to time.struct_time
.
For example, the command sequence:
now = datetime.now(timezone.utc).isoformat()
print (now)
Yields: 2024-02-12T00:18:44.621471+00:00
To convert this to unix time or the python time tuple, I need to use the strptime
format string of "%Y-%m-%dT%H:%M:%S.%f%z"
In short, I advocate adding a brief discussion of the %f
field, perhaps just in the table, to this section of the documentation.
This probably impacts documentation for other versions of python too.
Thank you!
Linked PRs
Metadata
Metadata
Assignees
Labels
Projects
Status