Re: [Q] Best practice about timezone conversion.
Hi,
The properties you mentioned are documented in
https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-configuration-properties.html.
As of your scenario, use the connection properties "useLegacyDatetimeCode" and "serverTimeZone" as before, no changes were made here. With regard to the connection properties "noTimezoneConversionForDateType" and "cacheDefaultTimezone", it depends on what you need:
- "noTimezoneConversionForDateType": setting to "false" turns on time zone adjustments in DATE values the same way as the remaining temporal data types (DATETIME, TIMESTAMP, TIME). Note that since DATE values don't contain time information (internally assumed to be 0:00:00.0), adjusting the time zone can cause a date to move to the previous or next day according to the differences between client and server time zones and, when retrieving such values, the time-zone re-adjustment may not be able to recover the original values since in the middle of the process any temporary time information ends up being truncated. The default for this property is "true" and is the recommended for most cases.
- "cacheDefaultTimezone": can be set to "false" to stop using the cached default time zone object (note that we cache this time zone object for performance reasons) and thus to be able to see changes in the default time zone - TimeZone.setDefault(TimeZone zone) - the client application does. The default is "true" and is the recommended one, unless the client needs to change the default time zone for some reason.
Hi hope that helps.