based/src/format.rs

24 lines
566 B
Rust
Raw Normal View History

2024-12-17 23:28:43 +01:00
pub fn format_date(date: &chrono::NaiveDate) -> String {
// TODO : Implement
date.to_string()
}
pub fn format_number(num: i32) -> String {
// TODO : Implement
num.to_string()
}
fn format_seconds_to_hhmmss(seconds: f64) -> String {
let total_seconds = seconds as u64;
let hours = total_seconds / 3600;
let minutes = (total_seconds % 3600) / 60;
let seconds = total_seconds % 60;
if hours != 0 {
format!("{:02}:{:02}:{:02}", hours, minutes, seconds)
} else {
format!("{:02}:{:02}", minutes, seconds)
}
}