I want a specific time format in Oracle SQL. The format is 2018-05-17T10:15:12-0300. Can anyone help me. I tried this but the last '-0300' is not reflecting in my result
Select to_char(systimestamp,'yyyy-mm-dd"T"hh:mm:ss"-Z"') from dual;
You can use the the format model YYYY-MM-DD"T"HH24:MI:SSTZHTZM, for instance
SELECT TO_CHAR(systimestamp, 'YYYY-MM-DD"T"HH24:MI:SSTZHTZM') FROM DUAL;
2018-06-01T13:04:44+0200
The date format models are explained in Oracle's SQL Language Reference.
TZH is the hours of the time zone, TZM the minutes. For instance, my example database is set to +0200, for Central European Summer Time, which is UTC + 2 hours. You can check your database with SELECT DBTIMEZONE FROM DUAL;
TO_CHAR()andDATETIMEformat models.