ms-convert
Convert human-readable time strings to milliseconds and vice versa. A Rust port of vercel/ms.
Zero dependencies.
Usage
Add to your Cargo.toml:
[]
= "0.1"
Parse a time string to milliseconds
use parse;
assert_eq!;
assert_eq!;
assert_eq!;
Format milliseconds to a human-readable string
use format;
assert_eq!;
assert_eq!;
assert_eq!;
Supported Units
| Short | Long (singular / plural) |
|---|---|
ms |
millisecond / milliseconds |
s |
sec / second / seconds |
m |
min / minute / minutes |
h |
hr / hour / hours |
d |
day / days |
w |
week / weeks |
mo |
month / months |
y |
year / years |
License
MIT