Type Alias timespan::naive::NaiveDateTimeSpan
source · pub type NaiveDateTimeSpan = Span<NaiveDateTime>;
Expand description
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);
Aliased Type§
struct NaiveDateTimeSpan {
pub start: NaiveDateTime,
pub end: NaiveDateTime,
}
Fields§
§start: NaiveDateTime
The starting point of the span.
end: NaiveDateTime
The end point of the span.