Expand description
Convert human-readable time strings to milliseconds and vice versa.
A Rust port of vercel/ms. Zero dependencies.
§Examples
use ms_convert::{parse, format};
// Parse time strings to milliseconds
assert_eq!(parse("2d").unwrap(), 172_800_000.0);
assert_eq!(parse("1h").unwrap(), 3_600_000.0);
// Format milliseconds to human-readable strings
assert_eq!(format(60_000.0, false), "1m");
assert_eq!(format(60_000.0, true), "1 minute");Enums§
- Parse
Error - Errors that can occur when parsing a time string.