Skip to content

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

License

Notifications You must be signed in to change notification settings

evanfoster/durationpy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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
# parse
td = durationpy.from_str("4h3m2s1ms")

# format
durationpy.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

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%