CI crates.io

time-fmt

This is a library that formats/parses datetime of the time crate with somewhat more strftime/strptime-compatible format specification.

You should really use the format of the time crate, if there's no strong reason not to.

Features

Non-features ...yet. Contributions are welcomed!

Incompatibilities / Cautions

Examples

```rust use time::{macros::{datetime, offset}, UtcOffset}; use time_fmt::{format::, parse::};

let dt = datetime!(2022-03-06 12:34:56);

// Format primitive date time asserteq!( formatdatetime("%Y-%m-%d %H:%M:%S", dt).unwrap(), "2022-03-06 12:34:56" ); // Format offset date time asserteq!( formatoffsetdatetime("%Y-%m-%d %H:%M:%S %z", dt.assumeoffset(offset!(+9:00))).unwrap(), "2022-03-06 12:34:56 +0900" ); // With timezonename feature asserteq!( formatzoneddatetime("%Y-%m-%d %H:%M:%S %Z", dt, offset!(+9:00), "JST").unwrap(), "2022-03-06 12:34:56 JST" ); // Parse date time asserteq!( parsedatetimemaybewithzone("%Y-%m-%d %H:%M:%S %z", "2022-03-06 12:34:56 +0900") .unwrap(), ( dt, Some(TimeZoneSpecifier::Offset( UtcOffset::fromhms(9, 0, 0).unwrap() )) ) ); ```

Publish new version

Note for myself.

shell $ git switch master # make sure you're on the master branch $ cargo release patch # to dry-run the release $ cargo release patch --execute # to actually execute the release

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.