Search code examples
oracletimezoneoracle12cutctimezone-offset

Convert Data to Oracle Data


I am receiving this date from a WS 2017-12-03T05:44:57 , that I want to convert to Oracle Date, but I don't T05 but refers exactly.

TZD Daylight savings information. For example, 'PST' ?
TZH Time zone hour. ?
TZM Time zone minute. ?
TZR Time zone region. ?

Solution

  • 2017-12-03T05:44:57 is according to ISO-8601 standard. T is the separator between date and time values (actually often it is skipped - and thus not strictly according to the standard)

    2017-12-03T05:44:57 does not contain any time information, i.e. you don't know the time zone.

    Time zone information are provided for example as 2017-12-03T05:44:57+08:00 or 2017-12-03T05:44:57Z for UTC times.

    Conversion to a DATE/TIMESTAMP would be like this

    SELECT 
        TO_DATE('2017-12-03T05:44:57', 'YYYY-MM-DD"T"HH24:MI:SS'),
        TO_TIMESTAMP('2017-12-03T05:44:57', 'YYYY-MM-DD"T"HH24:MI:SS')
    FROM dual;