I
I
ivandao2019-09-16 12:40:21
Oracle
ivandao, 2019-09-16 12:40:21

How to read date and time given time zone?

There is a field of type TIMESTAMP (6)
I write SYSTIMESTAMP into it - the current time (local) is written to the database (according to the viewer from SQL Developer), but when I read from the database, the time changes (perhaps they are already stored with an offset, and the viewer from SQL Developer displays local time).
How to pull the data so that it is in local time?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2019-09-16
@Stalker_RED

Set globally to UTC-0, and store in UTC-0.
(probably it is already configured this way, or the server's time zone is used, which can become a problem when moving)
Output local, or whatever you need already when sampling. Timezone parameters can be set before the request or when connecting.
SET time_zone = 'Europe/Helsinki';
SET time_zone = "+00:00";
SET @@session.time_zone = "+00:00";
well, or directly in the CONVERT_TZ() request, if you need to pull out several timezones, for example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question