How to convert timestamp with time zone to timestamp

I have the following created_dtm on a record on a sqldeveloper database.

18.11.13 16:47:20,677000000 EUROPE/LONDON

I need to subtract this date from another one on the same format.

I have tried to use from_tz function but can't get it to produce a timestamp that I can subtract to the other date.

How can I get timestamp with time zone to milisseconds timestamp?

Upvotes: 0

Views: 87

Answers (1)

hol
hol

Reputation: 8423

Not exactly sure what you try to do. If you you have a timestamp with timezone you can deduct them from each other. Demo:

SET LINESIZE 32000;    
with x as (
 select to_timestamp_tz('22/05/2019 09:47:00','DD/MM/YYYY HH24:MI:SS') t1,
        to_timestamp_tz('22/05/2019 09:57:10','DD/MM/YYYY HH24:MI:SS') t2 
   from dual)
select t2-t1, t1, t2
from x;

Output:

T2-T1                                              T1                                T2                               
-------------------------------------------------- --------------------------------- ---------------------------------
+00 00:10:10.000000                                22/05/2019 09:47:00.000000000 +02 22/05/2019 09:57:10.000000000 +02

Upvotes: 1

Related Questions