mirror of
https://forge.katzen.cafe/schrottkatze/nix-configs.git
synced 2024-11-28 23:48:44 +01:00
16 lines
374 B
Rust
16 lines
374 B
Rust
|
use chrono::{DateTime, FixedOffset};
|
||
|
|
||
|
pub fn format_datetime(ts: DateTime<FixedOffset>) -> String {
|
||
|
ts.format("%A, %-d. %B %Y %R").to_string()
|
||
|
}
|
||
|
|
||
|
pub fn format_datetime_padded(ts: DateTime<FixedOffset>) -> String {
|
||
|
format!(
|
||
|
"{:>9}{}{:<9}{}",
|
||
|
ts.format("%A, "),
|
||
|
ts.format("%d. "),
|
||
|
ts.format("%B"),
|
||
|
ts.format(" %Y %R"),
|
||
|
)
|
||
|
}
|