Type Definition timespan::naive::NaiveDateTimeSpan
[−]
[src]
type NaiveDateTimeSpan = Span<NaiveDateTime>;
The NaiveDateTimeSpan
alias is a span consisting of chrono::NaiveDateTime
s.
It can be used to represent datetime spans that do not depend on a specific time zone.
The NaiveDateTimeSpan
can be formatted and parsed from a string. It has full
support for serde
serialization and deserialization.
Example
use timespan::NaiveDateTimeSpan; let a: NaiveDateTimeSpan = "2017-02-20T11:30:00 - 2017-02-23T18:00:00".parse().unwrap(); let b = NaiveDateTimeSpan::parse_from_str( "02/20/17 11.30 am - 02/23/17 06.00 pm", "{start} - {end}", "%D %I.%M %p", "%D %I.%M %p" ).unwrap(); let f = a.format("from {start} to {end}", "%R on %A", "%R on %A"); assert!(format!("{}", f) == "from 11:30 on Monday to 18:00 on Thursday"); assert!(a == b);