Reputation: 59
In input I have a string datetime (yyyy-mm-dd HH:MI:SS), how can I convert it to HH:MI:SS dd/mm/yyyy in output?
Upvotes: 0
Views: 625
Reputation: 35900
You need to convert your string --> date --> string
to achieve it as follows:
-- consider, your string is - '2020-06-05 17:48:00'
SQL> SELECT TO_CHAR(
2 TO_DATE('2020-06-05 17:48:00',
3 'yyyy-mm-dd HH24:MI:SS'),
4 'HH24:MI:SS dd/mm/yyyy'
5 ) AS RES
6 FROM DUAL;
RES
-------------------
17:48:00 05/06/2020
SQL>
Upvotes: 1
Reputation: 1269553
You use to_char()
:
select to_char(col, 'HH24:MI:SS DD/MM/YYYY')
Upvotes: 0