[][src]Function ms_converter::ms_into_time

pub fn ms_into_time(s: &str) -> Result<Duration, Error>

Ms into time is the abstraction on ms function, which converts result into time.Duration type. ms_into_time function gets an str slice and returns time.Duration. ms_into_time has some limitations, it's not working with negative values:

use crate::ms_converter::ms_into_time;

let value = ms_into_time("-1d").is_err();
assert_eq!(value, true)

Example:

use crate::ms_converter::ms_into_time;

let value = ms_into_time("1d").unwrap();
assert_eq!(value.as_millis(), 86400000)