Re: Datetimes after a server timezone move
Posted by: Filipe Silva
Date: December 29, 2015 07:04PM

I'm not sure I understand your question 1). If what you want is to use time zone adjustments for new records and leave old records untouched, then no. After all there is no way of knowing what is an old records or new one. OTOH, by setting 'useLegacyDatetimeCode=false' you are choosing to perform time zone adjustments for all date/time values (note that you can fine tune the extent of time zone adjustments with the properties 'noTimezoneConversionForDateType' and 'noTimezoneConversionForTimeType').

Your statement: "use the local connection timezone for inserts/updates/selects", is also not clear. What is it you really want? Is it:
- save temporal values exactly as you "see" them in the client (client's wall time)? If so, then use 'useLegacyDatetimeCode=true' (and 'useTimezone=false'). This way no conversions occur. E.g. '2015-12-30 10:00:00' is stored as '2015-12-30 10:00:00'.
- save temporal values considering time zone offsets between client(s) and server? If so, please use 'useLegacyDatetimeCode=false', and your temporal data will be "normalized" to server's time zone, i.e., they with be saved as if you were looking at server's wall time at the exact same instant. E.g. '2015-12-30 10:00:00' is stored as '2015-12-30 18:00:00' if your server is in a time zone 8 hours ahead of the client. When reading data the time zone adjustments will be performed in the opposite direction. Mind that another client, in a different time zone, will see different time values, but all correspond to the same epoch time value. A warning were: NEVER configure your server with a DST aware time zone, or else you may get non deterministic time values whenever a DST switch occur.

Regarding your question 2), there is no risk of using 'useLegacyDatetimeCode=true'. After all the main difference between 'true' and 'false' values is if you prevent or allow time zone adjustments (assuming that 'useTimezone=false' as well). Maybe sometime in the future this property will be renamed to something more meaningful, but you will always have some option to leave temporal data untouched.

I hope that helps.

Options: ReplyQuote

Written By
Re: Datetimes after a server timezone move
December 29, 2015 07:04PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.