반응형



오라클에서 날짜와 시간 보여주기


SQL> SELECT TO_CHAR(SYSDATE, 'YYYYMMDDHH24MISS') FROM DUAL;

TO_CHAR(SYSDAT
--------------
20110322195156

 

오라클에서 날짜와 시간을 밀리초까지 보여주기


SQL> SELECT TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISSFF') FROM DUAL;

TO_CHAR(SYSTIMESTAMP,'Y
-----------------------
20110322195156406272


추가적인 사항


SQL> SELECT TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISSFF') FROM DUAL
  2  /

TO_CHAR(SYSTIMESTAMP,'Y
-----------------------
20111220145857765856

SQL> SELECT TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISSFF1') FROM DUAL
  2  /

TO_CHAR(SYSTIMESTAMP,'Y
-----------------------
201112201458577

SQL> SELECT TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISSFF2') FROM DUAL
  2  /

TO_CHAR(SYSTIMESTAMP,'Y
-----------------------
2011122014585780

SQL> SELECT TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISSFF3') FROM DUAL
  2  /

TO_CHAR(SYSTIMESTAMP,'Y
-----------------------
20111220145857828

SQL> SELECT TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISSFF4') FROM DUAL
  2  /

TO_CHAR(SYSTIMESTAMP,'Y
-----------------------
201112201458578483

SQL> SELECT TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISSFF5') FROM DUAL
  2  /

TO_CHAR(SYSTIMESTAMP,'Y
-----------------------
2011122014585786779

SQL> SELECT TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISSFF6') FROM DUAL
  2  /

TO_CHAR(SYSTIMESTAMP,'Y
-----------------------
20111220145857887800

SQL> SELECT TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISSFF7') FROM DUAL
  2  /

TO_CHAR(SYSTIMESTAMP,'Y
-----------------------
201112201458579078970

SQL> SELECT TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISSFF8') FROM DUAL
  2  /

TO_CHAR(SYSTIMESTAMP,'Y
-----------------------
2011122014585792819600

SQL> SELECT TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISSFF9') FROM DUAL
  2  /

TO_CHAR(SYSTIMESTAMP,'Y
-----------------------
20111220145858935123000

SQL>



FF 의 설명 부분 1~9까지 설정가능..

FF [1..9]

Fractional seconds; no radix character is printed (use the X format element to add
the radix character). Use the numbers 1 to 9 after FF to specify the number of
digits in the fractional second portion of the datetime value returned. If you do
not specify a digit, then Oracle Database uses the precision specified for the
datetime datatype or the datatype’s default precision.
Examples: ’HH:MI:SS.FF’
SELECT TO_CHAR(SYSTIMESTAMP, ’SS.FF3’) from dual;

( http://docs.oracle.com/cd/B19306_01/server.102/b14195.pdf )


반응형
Posted by 공간사랑
,