[hibernate-dev] Date/Time Support and timezones

Steve Ebersole steve at hibernate.org
Sun Mar 22 22:54:55 EDT 2015

As I start work on supporting Java 8 Date/Time types, I wanted to get
everyone's opinion on handling OffsetDateTime, OffsetTime and ZonedDateTime
with regards to timezone.  Each represent a date/time in a particular
timezone/offset (much like a Calendar).  A few options:

1) Forego OffsetDateTime, OffsetTime and ZonedDateTime support and just
stick with LocalDateTime, LocalDate and LocalTime.
2) Use the timezone/offset to pass along to the driver (for proper
conversion); when reading back we'd have to read back based on the default
timezone.  This is essentially the old strategy used in CalendarType which
I never really liked because its not reflexive.
3) Break them into a tuple of the store each piece.  E.g., for
OffsetDateTime the Tuple is a LocalDateTime (the Timestamp) and a TZ
offset.  So we'd store each individually in the database and be able to
rebuild them in a fully reflexive manner.
4) Handle them using UTC or GMT at the JDBC level.  This is essentially the
same as (2)

More information about the hibernate-dev mailing list