#libc #strftime #calendar #glibc #date-time #api-bindings

libc-strftime

A wrapper library for the glibc strftime function

2 unstable releases

0.2.0 Aug 15, 2019
0.1.0 Aug 7, 2019

#438 in Date and time

Download history 34/week @ 2024-03-11 25/week @ 2024-03-18 31/week @ 2024-03-25 72/week @ 2024-04-01 16/week @ 2024-04-08 22/week @ 2024-04-15 24/week @ 2024-04-22 23/week @ 2024-04-29 22/week @ 2024-05-06 30/week @ 2024-05-13 32/week @ 2024-05-20 22/week @ 2024-05-27 30/week @ 2024-06-03 23/week @ 2024-06-10 26/week @ 2024-06-17 34/week @ 2024-06-24

116 downloads per month
Used in 3 crates (2 directly)

MIT license

9KB
125 lines

Build Status Latest Version License Docs.rs LOC Dependency Status

libc-strftime

A wrapper library for the glibc strftime function.

Why?

There is currently no way in Rust to get translated date and time.

Examples

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

Known Issues

  • The translation doesn't seem to work with MUSL.

Dependencies

~43KB