Module for converting between datetime.timedelta and Go's Duration strings.
Project Links
Meta
Author: Ilia Choly
Requires Python: >=3.10
Classifiers
durationpy
Module for converting between
datetime.timedeltaand Go's Duration strings.
Install
$ pip install durationpy
Parse
ns- nanosecondsus- microsecondsms- milliseconds- secondm- minuteh- hourd- dayw- weekmm- monthy- year
# parse
td = durationpy.from_str("4h3m2s1ms")
# format
durationpy.to_str(td)
Note: nanosecond precision is lost because datetime.timedelta uses microsecond resolution.
0.12
Nov 24, 2026
0.11
Aug 26, 2026
0.10
May 17, 2025
0.9
Oct 02, 2024
0.8
Oct 01, 2024
0.7
Jul 12, 2024
0.6
Dec 08, 2023
0.5
Aug 01, 2017
0.4
Apr 19, 2017
0.3
Jan 23, 2017
Wheel compatibility matrix
Files in release
No dependencies