DateTime Types

DATE

Day, Month, Year, Hour, Minute, Second

DECLARE
    l_date date := '10-nov-13';
BEGIN
    dbms_output.PUT_LINE('first: ' || l_date);  -- 10-NOV-13

    l_date := TO_DATE('10-NOV-2013 15:25:34', 'DD-MON-RRRR HH24:MI:SS');
    dbms_output.PUT_LINE('second: ' || l_date);  -- 10-NOV-13

    l_date := TO_DATE('11/10/2013 15:25:34', 'MM/DD/RRRR HH24:MI:SS');
    dbms_output.PUT_LINE('third: ' || l_date);  -- 10-NOV-13
END;

CURRENT_DATE returns the session date, SYSDATE returns the database server date.

TIMESTAMP

Date plus fractional seconds (e.g. 11-NOV-2013 14:25:34.234). Specify the precision from 0-9 using TIMESTAMP(precision), or it will default to a precision of 6.

TIMESTAMP WITH TIME ZONE

Timestamp with additional time zone data. CURRENT_TIMESTAMP returns the session timestamp with time zone, and SYSTIMESTAMP returns the database server timestamp with time zone.

INTERVAL YEAR TO MONTH

Period of time in years and months.

INTERVAL DAY TO SECOND

Period of time in day and fractional seconds.

results matching ""

    No results matching ""