Skip to main content

format_interval_styled

Function format_interval_styled 

Source
pub fn format_interval_styled(
    months: i32,
    days: i32,
    micros: i64,
    style: &RenderStyle,
) -> String
Expand description

format_interval under an IntervalStyle (PG18 differential truth):

  • sql_standard — pure year-month 1-2 / -1-2; pure day-time 1 0:00:00 (sign on the leading field, time fields absolute; time-only 2:00:00 / -0:00:01); a mix of year-month and day-time classes (or mixed signs) is non-conforming and prints every part explicitly signed: +1-2 +3 +4:05:06, +0-1 -1 +0:00:00; zero → 0.
  • iso_8601 — P[nY][nM][nD][T[nH][nM][nS]], each field individually signed, zero → PT0S.
  • postgres_verbose — @ + years/mons/days/hours/mins/secs fields; when the interval compares below zero every field is negated and ago is appended; zero → @ 0.