hibernate-orm/design/doc-temporal.adoc

11 lines
701 B
Plaintext

`OffsetDateTime` is not safe to store in database. This form does not understand "zone rules" relating to things
such as DST. An offset of +5, e.g., does not change when DST starts/ends - its just +5.
A `ZonedDateTime` on the other hand knows the actual timezone as well as the offset for the LocalDateTime portion in
that timezone. It is much more complete picture of the actual Instant.
The proper solution for storing "with tz" would be to always use a `ZonedDateTime`, converted from `OffsetDateTime`
if needed. In this case, I assume we need to transform a `LocalDateTime` to `ZonedDateTime`?
^^ what about Dialects that do not support "with tz" datatype variants? Are there any anymore?