Oracle to_date function. Mask needed

Andrey Khataev picture Andrey Khataev · Sep 16, 2010 · Viewed 14.4k times · Source

I have string of date from xml file of such kind: '2010-09-09T22:33:44.OZ'

I need to extract only date and time. I want to ignore symbol T and .OZ (time zone). Which mask I should use? Thanks in advance

Answer

Jeffrey Kemp picture Jeffrey Kemp · Sep 16, 2010
select TO_DATE('2010-09-09T22:33:44.OZ'
              ,'YYYY-MM-DD"T"HH24:MI:SS".OZ"')
from dual;

9/09/2010 10:33:44 PM