Skip to content

A wrapper library for the glibc strftime function

License

Notifications You must be signed in to change notification settings

cecton/libc-strftime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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::tz_set();
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.

About

A wrapper library for the glibc strftime function

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages