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?
-
output also must be in stringUmid Umaraliev– Umid Umaraliev2020-06-05 10:56:42 +00:00Commented Jun 5, 2020 at 10:56
-
Please clarify, as this is often a point of confusion. What is the actual data type of your "string datetime"? is it really a 'string" (varchar or varchar2) or is it of datatype DATE? If it is DATE, then you would use @Gordon Linoff answer. If it is truely a string, then you would simply use SUBSTR.EdStevens– EdStevens2020-06-05 11:39:20 +00:00Commented Jun 5, 2020 at 11:39
Add a comment
|
2 Answers
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>