Skip to main content

parse_interval_text

Function parse_interval_text 

Source
pub fn parse_interval_text(s: &str) -> Option<(i32, i64)>
Expand description

Parse the text inside INTERVAL '...' into (months, micros). Accepts one or more <n> <unit> pairs separated by whitespace. <n> may be negative. Returns None if any pair fails to parse or no pair is found.

Recognised units (case-insensitive, optional trailing s): microsecond, millisecond, second, minute, hour, day, week, month, year. week widens to 7 days; year widens to 12 months.