| Crates.io | humantime_fmt |
| lib.rs | humantime_fmt |
| version | 0.1.0 |
| created_at | 2025-07-01 20:24:48.1634+00 |
| updated_at | 2025-07-01 20:24:48.1634+00 |
| description | A simple human-readable time formatter for durations and timestamps. |
| homepage | |
| repository | https://github.com/haffizaliraza/humantime_fmt |
| max_upload_size | |
| id | 1733758 |
| size | 1,406,196 |
A lightweight Rust crate to convert durations or timestamps into human-friendly strings.
use humantime_fmt::format_relative;
use std::time::{SystemTime, Duration};
let now = SystemTime::now();
let past = now - Duration::from_secs(60 * 60 * 24); // 1 day ago
let future = now + Duration::from_secs(60 * 60 * 24 * 7); // in 1 week
assert_eq!(format_relative(past), "yesterday");
assert_eq!(format_relative(future), "in 1 week");
humantime_fmt = "0.1"
For chrono support:
humantime_fmt = { version = "0.1", features = ["chrono"] }
Licensed under either of: