Database Administration (MOSC)

MOSC Banner

oracle not able to compute a timestamp difference in seconds

Hi,

Running on oracle 12.2 SE2. Same happens on oracle 19.10 SE.

I want to calculate the number of seconds between 2 timestamps.

SYS@ABIECTEST 2024-10-08 12:23:17> select extract(second from (to_timestamp('2024-04-21 00:00:00','YYYY-MM-DD HH24:MI:SS') - to_timestamp('2023-01-01 00:00:00','YYYY-MM-DD HH24:MI:SS'))) from dual;

EXTRACT(SECONDFROMTO_TIMESTAMP('2024-04-2100:00:00','YYYY-MM-DDHH24:MI:SS')-TO_TIMESTAMP('2023-01-0100:00:00','YYYY-MM-DDHH24:MI:SS'))

                                                                                                                                 0

SYS@ABIECTEST 2024-10-08 12:27:38> select to_timestamp('2024-04-21 00:00:00','YYYY-MM-DD HH24:MI:SS') - to_timestamp('2023-01-01 00:00:00','YYYY-MM-DD HH24:MI:SS') from dual;

TO_TIMESTAMP('2024-04-2100:00:00','YYYY-MM-DDHH24:MI:SS')-TO_TIMESTAMP('202

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center