Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

DIFFERENCE BETWEEN TWO DATE FIELDS IN SECONDS

ShahiniADAug 12 2022

Hi ,
I need a difference value in seconds for two date formats.
i have got the value in this format = +439 15:33:07.200000.how can this be truncated to get only 439.
i tried with dual -SELECT TRUNC(TO_NUMBER(TO_DATE('8/9/2022 11:29:04 AM','MM/DD/YYYY HH:MI:SS AM')-
TO_DATE('8/9/2022 11:21:46 AM','MM/DD/YYYY HH:MI:SS AM')) * 24 * 60 * 60) DURATION FROM DUAL. the value getting is 439.

When i am trying the same logic in the able with fields,getting error.
query needs the seconds value- select TRUNC(TO_NUMBER(TO_DATE(TO_TIMESTAM(LASTTRACKED-RECEIVEDDATE)) *24*60*60) As dur from table_name;

Comments
Post Details
Added on Aug 12 2022
6 comments
3,466 views