aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/durationpy/README.md
blob: 2c01d9266bc0e4840f189df4ad0838e9ae98fdc8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# durationpy

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

### Install

``` sh
$ pip install durationpy
```


### Parse

* `ns` - nanoseconds
* `us` - microseconds
* `ms` - millisecond
* `s` - second
* `m` - minute
* `h` - hour

``` py
# parse
td = durationpy.from_str("4h3m2s1ms")

# format
durationpy.to_str(td)
```

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