4 个版本

0.1.3 2021年11月21日
0.1.2 2021年11月17日
0.1.1 2021年11月17日
0.1.0 2021年11月16日

#202值格式化

Download history 914/week @ 2024-03-14 719/week @ 2024-03-21 679/week @ 2024-03-28 585/week @ 2024-04-04 620/week @ 2024-04-11 633/week @ 2024-04-18 542/week @ 2024-04-25 770/week @ 2024-05-02 561/week @ 2024-05-09 598/week @ 2024-05-16 673/week @ 2024-05-23 576/week @ 2024-05-30 527/week @ 2024-06-06 702/week @ 2024-06-13 651/week @ 2024-06-20 523/week @ 2024-06-27

2,468 每月下载次数
4 crates 中使用

MIT 许可证

22KB
453

time-humanize

A rust crate that displays duration in a human readable format.

This project is a port of chrono-humanize-rs and now has 0 dependencies.

用法

use std::time::Duration;
use time_humanize::HumanTime;


let duration = Duration::from_secs(60);
let human_time = HumanTime::from(duration);
println!("{}", human_time);

lib.rs:

time-humanize - A crate to display std::time::Duration in a human readable way

示例

use std::time::Duration;
use time_humanize::HumanTime;

let duration = Duration::from_secs(60);

println!("{}", HumanTime::from(duration));
println!("{}", HumanTime::from_seconds(-60));

依赖项

~175KB