-
Notifications
You must be signed in to change notification settings - Fork 21
Date, Time, Time Zone
Mirro Mutth edited this page Feb 27, 2024
·
7 revisions
These options will affect how the driver uses time zones, and their impact should be the same as mysql-connector-j
.
See also https://dev.mysql.com/blog-archive/support-for-date-time-types-in-connector-j-8-0/
They will be affected by preserveInstants and connectionTimeZone.
java.time.ZonedDateTime
java.time.OffsetDateTime
java.time.Instant
They are not affected by time zones.
java.time.LocalDateTime
java.time.LocalDate
java.time.LocalTime
java.time.OffsetTime
-
java.time.Duration
: duringTIME
field can be a value between '-838:59:59.000000' to '838:59:59.000000' java.time.Year
- Since 0.8.2, option
serverZoneId
is available- Used to specify the time zone of the connection. If not set, driver will query server time zone on initialization
- Driver receive "zoned" date time and converts its time zone to local:
ZonedDateTime
,Instant
,OffsetDateTime
andOffsetTime
- Driver send "zoned" date times with connection time zone
- All "local" date times (e.g.
LocalDateTime
) time zone will not be converted
- Since 1.0.4, change
DATETIME
/TIMESTAMP
default mapping toZonedDateTime
- Since 1.1.2, considering various factors and the impact of feedback on version 1.0.4, we finally made adjustments to make behavior as same as possible with JDBC
- Add
preserveInstants
,forceConnectionTimeZoneToSession
, andconnectionTimeZone
- Default
connectionTimeZone
to "LOCAL", which means driver will use JVM local time zone by default -
OffsetTime
will no longer be affected by time zone - Default
DATETIME
toLocalDateTime
,TIMESTAMP
toZonedDateTime
- In JDBC,
TIMESTAMP
should bejava.sql.Timestamp
by default, but we avoid using the old date time type
- In JDBC,
- Add