How to construct an OffsetDateTime from ymd+hms #442
-
Hi, I'm trying to figure out how to make an I see I can construct the two parts separately like |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
What you're looking for is: Date::from_calendar_date(2010, Month::January, 2)?
.with_hms(3, 4, 5)?
.assume_utc() Assuming you want UTC to be the offset. If not, you'll want to use If these values are statically known, I suggest you use the macros instead: datetime!(2010-01-02 03:04:05 UTC) |
Beta Was this translation helpful? Give feedback.
UtcOffset::from_hms(3, 4, 5)
creates an offset from UTC, not a time.What you're looking for is:
Assuming you want UTC to be the offset. If not, you'll want to use
PrimitiveDateTime::assume_offset
.If these values are statically known, I suggest you use the macros instead: