9 lines · 295 bytes
1use chrono::{Datelike, NaiveDateTime};
2
3/// Convert timestamp into `DD/MM/YYYY`
4pub fn date_text(timestamp: u64) -> String {
5 let date = NaiveDateTime::from_timestamp_opt(timestamp as i64, 0)
6 .unwrap()
7 .date();
8 format!("{}/{}/{}", date.day(), date.month(), date.year())
9}