#日期格式 #样式 #Java #字符串 #

simpledateformat

类似SimpleDateFormat的日期格式

6个版本

0.1.4 2023年9月5日
0.1.3 2021年10月15日
0.1.2 2021年6月10日
0.1.1 2020年6月25日
0.0.0 2020年5月28日

#1087解析器实现

Download history 1285/week @ 2024-04-20 1228/week @ 2024-04-27 515/week @ 2024-05-04 1640/week @ 2024-05-11 441/week @ 2024-05-18 1178/week @ 2024-05-25 919/week @ 2024-06-01 758/week @ 2024-06-08 911/week @ 2024-06-15 713/week @ 2024-06-22 507/week @ 2024-06-29 1103/week @ 2024-07-06 1020/week @ 2024-07-13 829/week @ 2024-07-20 789/week @ 2024-07-27 943/week @ 2024-08-03

3,683 每月下载量
4 包(直接使用2个)中使用

MIT 许可证

14KB
284

simpledateformat

类似SimpleDateFormat的日期格式

用法

let f = match fmt("yyyy-MM-dd HH:mm:ss z") {
    Ok(f) => f, Err(err) => {
        println!("Parse fmt error: {}", err);
        return;
    },
};
println!("Formated date: {}", f.format(&Local::now()));

输出

Formated date: 2020-05-30 13:32:04 +08:00
format_human(Duration::from_secs(2 * 24 * 60 * 60 + 1));

输出

2days 0hour 0min 1s

更多测试

https://git.hatter.ink/hatter/simpledateformat/src/branch/master/tests/lib_test.rs

日志

  • 2020年6月23日 - v0.1.1
    • 添加 simpledateformat::new_with_out_err(&str)
    • 添加 impl TryFrom<&str> for SimpleDateFormat

依赖

~1MB
~19K SLoC