본문 바로가기

Oracle

현재 날짜 가져오기!

CURRENT_TIMESTAMP 함수
--------------------------------------------------------------------------------
session의 날짜와 시간 정보를 반환하는 함수
current_timestamp는 time zone까지 출력되지만,
localtimestamp는 time zone은 출력되지 않는다.

【예제】
SQL> select current_timestamp, localtimestamp,
  2      current_date from dual;
CURRENT_TIMESTAMP
--------------------------------------------------------------------------
LOCALTIMESTAMP
--------------------------------------------------------------------------
CURRENT_D
---------
04-AUG-04 11.17.40.768776 AM +09:00
04-AUG-04 11.17.40.768776 AM
04-AUG-04

ps). select to_char(sysdate, 'yyyy-mm-dd hh:mi:ss) from dual

요건 밀리세컨드(ff)가 안나온다.

(X)select to_char(sysdate, 'yyyy-mm-dd hh:mi:ss.ff) from dual