Skip to Main Content
  • Questions
  • Timestamp with time zone comparison Issues

Breadcrumb

May 4th

Question and Answer

Chris Saxon

Thanks for the question, Manoj.

Asked: April 28, 2021 - 2:52 pm UTC

Last updated: April 29, 2021 - 12:52 pm UTC

Version: 11g R2

Viewed 1000+ times

You Asked

Hi,

I am facing an issue while validating timestamp with timezone data with systimestamp in 11g R2.
My DB server is in US/Central zone.

I have a table with timestamp with timezone data type column and I have inserted a future timestamp for same timezone (US/Central or UTC-5).
While selecting data from table, we get same data.

I also have an anonymous block which verifies if timestamp in table crossed systimestamp of not.

Before daylight saving changes on March, this process was working correctly. both methods returns correct output when systimestamp is greater than timestamp with timezone column.
However, after daylight saving changes, record which was inserted by giving timezone as US/Central format, returns correct output only after 1hr from actual time.

I have given a sample in livesql, hope this can help to explain issue I am facing.

Is there any specific reason for this behavior?

Thanks in advance for your help

Thanks,
Manoj

with LiveSQL Test Case:

and Chris said...

I have inserted a future timestamp for same timezone (US/Central or UTC-5)

These are NOT the same time zone!

UTC-5 is always five hours behind UTC.

US/Central is either five or six hours behind, depending on whether daylight savings is in effect. Daylight savings are on in April, so currently US/Central -> UTC-6.

Systimetamp returns the date and time zone of the OS the database is installed on. If this uses a fixed time zone offset (e.g. UTC), then the difference between systimestamp and US/Central will switch between five and six hours, depending on the time of year.

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

SQL

The Oracle documentation contains a complete SQL reference.