At present, the best way to convert an OffsetDateTime to PrimitiveDateTime is to use the new function and construct it from parts. If OffsetDateTime::date_time was public, the conversion below wouldn't be necessary.
I use PrimitiveDateTime for database storage where columns are typically stored without a timezone for UTC.
let now = OffsetDateTime::now_utc();
let primitive = PrimitiveDateTime::new(now.date(), now.time());
Hello,
At present, the best way to convert an
OffsetDateTime
toPrimitiveDateTime
is to use thenew
function and construct it from parts. IfOffsetDateTime::date_time
was public, the conversion below wouldn't be necessary.I use
PrimitiveDateTime
for database storage where columns are typically stored without a timezone for UTC.