Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How I can substract one timestamp from another in Oracle

How can I subtract one timestamp from another in Oracle?

for example I have:

timestamp_1 = 2021-06-25 08:18:17,207141
timestamp_2 = 2021-06-24 17:41:06,787111

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

how I can take a different between?

I need a diff in seconds

>Solution :

You can simply subtract the two values from each other

SELECT   TO_TIMESTAMP ('2021-06-25 08:18:17,207141', 'YYYY-MM-DD HH24:MI:SS,FF')
       - TO_TIMESTAMP ('2021-06-24 17:41:06,787111', 'YYYY-MM-DD HH24:MI:SS,FF')
  FROM DUAL;


+00 14:37:10.420030
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading