use chrono::{DateTime, Local};

pub fn timestamp_to_string(ts: i64) -> String {
    if let Some(dt) = DateTime::from_timestamp(ts, 0) {
        DateTime::<Local>::from(dt)
            .format("%Y-%m-%d %H:%M:%S")
            .to_string()
    } else {
        String::new()
    }
}

pub fn now_to_string(fmt: &str) -> String {
    Local::now().format(fmt).to_string()
}
