format_relative_time

Function format_relative_time 

Source
pub fn format_relative_time(timestamp: &DateTime<Utc>) -> String
Expand description

Format a timestamp into a human-readable relative time.

Converts a timestamp into a relative time string like “2 hours ago” or “just now”.

§Examples

let now = Utc::now();
let past = now - Duration::minutes(5);
assert!(format_relative_time(&past).contains("ago"));