1

I have a string '2020-10-12T13:55:28+03:00', where the "t" character separates date from time. How to convert in into timestamp with time zone? I tried:

SELECT TO_TIMESTAMP_TZ('2020-10-12T13:55:28+03:00','YYYY-MM-DDTHH24:MI:SSTZH:TZM') 
  FROM DUAL;

But it doesn't work. I can use similar expression without "t":

SELECT TO_TIMESTAMP_TZ('2020-10-1213:55:28+03:00','YYYY-MM-DDHH24:MI:SSTZH:TZM') 
  FROM DUAL;

But I need convert string with the symbol "t".

Barbaros Özhan
  • 59,113
  • 10
  • 31
  • 55

1 Answers1

1

You just need double quotes for the letter T:

SELECT TO_TIMESTAMP_TZ('2020-10-12T13:55:28+03:00','YYYY-MM-DD"T"HH24:MI:SSTZH:TZM') 
    AS "Result"
  FROM DUAL;

Result
----------------------------------------------
12-OCT-20 01.55.28.000000000 PM +03:00
Barbaros Özhan
  • 59,113
  • 10
  • 31
  • 55