Skip to main content

format_distance

Function format_distance 

Source
pub fn format_distance(
    date: DateTimeType,
    base_date: NaiveDateTime,
    include_seconds: bool,
    add_suffix: bool,
    hide_prefix: bool,
) -> String
Expand description

Get the time difference between two dates into a relative human readable string.

For example, “less than a minute ago”, “about 2 hours ago”, “3 months from now”, etc.

Use format_distance_from_now to compare a NaiveDateTime against now.