Oracle RDBMS converting Date With Time to_char

Viewed 13

I am having a query that looks like this below

SELECT TO_CHAR(order_date_time,'DD-MM-YYYY') FROM CUSTOMERS;

What i want to achieve is order_date_time to return a date and time that looks like this below

2021-01-07T01:26:01

Below is how i have tried to modify the query to return the above date

SELECT TO_CHAR(order_date_time, 'DD-MM-YYYYTHH-MM-SS') FROM CUSTOMERS;

But the query is not executing and it is returning error ORA-01821: date format not recognized

I have tried spacing time after date like below and its working

SELECT TO_CHAR(order_date_time, 'DD-MM-YYYY HH-MM-SS') FROM CUSTOMERS;

What might be the issues that is causing TO_CHAR with T not to work

0 Answers
Related