Uncategorized

Date in ISO8601 Format in Oracle DB

Below the code example how to get date format as ISO8601. First example is current time zone. Second example is valid if your database is actually in UTC time zone.

SELECT to_char(SYSTIMESTAMP, 'YYYY-MM-DD"T"HH24:MI:SS.FF6TZH:TZM') AS ISO8601 FROM dual;
SELECT to_char(SYSTIMESTAMP, 'YYYY-MM-DD"T"HH24:MI:SS.FF6"Z"') AS ISO8601_UTC_format FROM dual;

Leave a Reply

Your email address will not be published. Required fields are marked *