ordinal 0.4.0

Format numbers as ordinals efficiently.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
// Copyright 2023 Heath Stewart.
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.

// cspell:ignore datelike
use chrono::{DateTime, Datelike as _, Local};
use ordinal::ToOrdinal as _;

fn main() {
    let now: DateTime<Local> = Local::now();
    let format = format!("%A, %B %-d{}, %Y %-I:%M:%S %p", now.day().suffix());
    println!("{}", now.format(format.as_ref()));
}