[][src]Function ms_converter::ms

pub fn ms<'a, T>(s: T) -> Result<i64, Error> where
    T: Into<Cow<'a, str>>, 

Fast abstraction for converting human-like times into milliseconds. ms function gets an str slice or String and returns how much milliseconds in your pattern.

Usage

use crate::ms_converter::ms;

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

Supported time strings

  • Years: years, year, yrs, yr, y
  • Weeks: weeks, week, w
  • Days: days, day, d
  • Hours: hours, hour, hrs, hr, h
  • Minutes: minutes, minute, mins, min, m
  • Seconds: seconds, second, secs, sec, s
  • Milliseconds: milliseconds, millisecond, msecs, msec, ms and empty postfix