Skip to content

Repository files navigation

durationpy

Module for converting between datetime.timedelta and Go's Duration strings.

Install

$ pip install durationpy

Parse

  • ns - nanoseconds
  • us - microseconds
  • ms - millisecond
  • s - second
  • m - minute
  • h - hour
  • d - day
  • w - week
  • mm - month
  • y - year
# parsetd=durationpy.from_str("4h3m2s1ms")
# formatdurationpy.to_str(td)

Note: nanosecond precision is lost because datetime.timedelta uses microsecond resolution.

About

Module for converting between datetime.timedelta and Go's time.Duration strings.

Resources

Stars

41 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages