본문 바로가기

데이터베이스/ORACLE

[ORACLE] TO_CHAR, TO_DATE 함수로 초까지 나타내기

 

SELECT TO_CHAR(TO_DATE('20200324', 'YYYYMMDDHH24MISS'), 'YYYY-MM-DD HH24:MI:SS') AS TO_DATE_형식1
     , TO_CHAR(TO_DATE('20200324', 'YYYYMMDDHH24MISS'), 'YYYY/MM/DD HH24:MI:SS') AS TO_DATE_형식2
     , TO_CHAR(TO_DATE('20200324', 'YYYYMMDDHH24MISS'), 'DD/MM/YYYY HH24:MI:SS') AS TO_DATE_형식3
  FROM DUAL;
  
  
  SELECT TO_DATE('20180101010101', 'YYYYMMDDHHMISS') AS GO FROM DUAL;
SELECT TO_DATE('20180101000035', 'YYYYMMDDHH24MISS') FROM DUAL;
SELECT TO_DATE('2017-05-12 23:59:59', 'YYYY-MM-DD HH24:MI:SS') FROM DUAL;
SELECT TO_TIMESTAMP('20180101000035', 'YYYYMMDDHH24MISS', 'FF1') FROM DUAL;

hello-nanam.tistory.com/280