kmunish
kmunish

Reputation: 21

Oracle current_timestamp method stores timestamp column values with GMT timezone instead of local timezone

Column is defined as of type Timestamp:

CREATE_TS NOT NULL TIMESTAMP(6)

While doing an insert we use Oracle CURRENT_TIMESTAMP method to store the timestamp data. The database is set with EST/EDT timezone:

SELECT SESSIONTIMEZONE, CURRENT_TIMESTAMP FROM DUAL;

SESSIONTIMEZONE CURRENT_TIMESTAMP
America/New_York 08-JUN-22 12.40.26.305481000 AM AMERICA/NEW_YORK

Data stored with GMT timezone, can someone please provide if there is any explanation/suggestions this is causing?|

Upvotes: 0

Views: 137

Answers (1)

MT0
MT0

Reputation: 168406

  • CURRENT_TIMESTAMP returns the timestamp based on the time zone of the client.
  • SYSTIMESTAMP returns the timestamp based on the time zone of the server's operating system.

If you INSERT data from a client application that is configured to be in the GMT time zone then when you use CURRENT_TIMESTAMP you will get a GMT time zone.

If you want to use the server's time zone and not the client's then use SYSTIMESTAMP.

Upvotes: 0

Related Questions