Crates.io | libc-strftime |
lib.rs | libc-strftime |
version | 0.2.0 |
source | src |
created_at | 2019-08-07 06:09:12.198821 |
updated_at | 2019-08-15 16:01:44.605072 |
description | A wrapper library for the glibc strftime function |
homepage | https://github.com/cecton/libc-strftime |
repository | https://github.com/cecton/libc-strftime |
max_upload_size | |
id | 154747 |
size | 10,366 |
A wrapper library for the glibc strftime function.
There is currently no way in Rust to get translated date and time.
Format the current date and time in Brussels in French:
use std::env;
env::set_var("LC_ALL", "fr_BE.UTF-8");
env::set_var("TZ", "Europe/Brussels");
libc_strftime::tzset();
libc_strftime::set_locale();
let now = libc_strftime::epoch(); // most likely a u64
let local = libc_strftime::strftime_local("%c", now);
println!("On est: {}", local); // On est: mer 07 aoĆ» 2019 06:19:56 CEST