Crates.io | chrono_lc |
lib.rs | chrono_lc |
version | 0.1.7 |
source | src |
created_at | 2023-09-06 07:42:46.585976 |
updated_at | 2024-05-12 17:10:04.747658 |
description | Localised date and time formatting library for Rust, based on chrono |
homepage | https://github.com/0x5eal/chrono-locale |
repository | https://github.com/0x5eal/chrono-locale |
max_upload_size | |
id | 965065 |
size | 116,389 |
This crate allows to format chrono dates with localized months and week days. Backwards comptible fork of Alex-PK/chrono-locale, now works with the latest version of chrono.
Include the dependency in Cargo.toml
:
[dependencies]
chrono = "0.4"
chrono_lc = "0.1.7"
Import the required modules into lib.rs
or main.rs
:
use chrono::prelude::*;
use chrono_lc::LocaleDate;
Note You can choose to import just parts of chrono instead of the whole prelude. Please see
chrono
's documentation.
To format a chrono Date
or DateTime
object, you can use the formatl
method:
let dt = FixedOffset::east_opt(34200)
.unwrap()
.with_ymd_and_hms(2001, 7, 8, 0, 34, 59)
.unwrap()
.with_nanosecond(1_026_490_708)
.unwrap();
println!("{}", dt.formatl("%c", "fr"));
Warning All of chrono's formatting placeholders work except for
%3f
,%6f
and%9f
(but%.3f
,%.6f
and%.9f
work normally).