#date-format #style #java #string #duration

simpledateformat

SimpleDateFormat.java style like date format

6 releases

0.1.4 Sep 5, 2023
0.1.3 Oct 15, 2021
0.1.2 Jun 10, 2021
0.1.1 Jun 25, 2020
0.0.0 May 28, 2020

#258 in Date and time

Download history 1210/week @ 2024-08-16 765/week @ 2024-08-23 1069/week @ 2024-08-30 803/week @ 2024-09-06 1215/week @ 2024-09-13 542/week @ 2024-09-20 514/week @ 2024-09-27 849/week @ 2024-10-04 1352/week @ 2024-10-11 1370/week @ 2024-10-18 1145/week @ 2024-10-25 1809/week @ 2024-11-01 3756/week @ 2024-11-08 1826/week @ 2024-11-15 2777/week @ 2024-11-22 1077/week @ 2024-11-29

10,439 downloads per month
Used in 5 crates (2 directly)

MIT license

14KB
284 lines

simpledateformat

SimpleDateFormat.java style like date format

Usage:

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()));

Output:

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

Output:

2days 0hour 0min 1s

More tests:

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

Log

  • Jun 23, 2020 - v0.1.1
    • add simpledateformat::new_with_out_err(&str)
    • add impl TryFrom<&str> for SimpleDateFormat

Dependencies

~1MB
~19K SLoC