Oracle DATE vs TIMESTAMP |Comparing Oracle DATE and TIMESTAMP Datatypes

0 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 0 Buffer 0 Email -- Filament.io 0 Flares ×

DATE datatype.DATE datatype has the ability to store the month, day, year, century, hours, minutes, and seconds.But TIMESTAMP datatype which stores all the information that the DATE datatype stores,and also includes fractional seconds.
See the query results below.There is a fractional seconds part of ‘.000000’ on the end the query result.

Examples:

SQL>
SQL> set serveroutput on;
SQL>
SQL> -- Created on 11/19/2008 by Globinch SQLTIPS
SQL> declare
    -- Local variables here
    test_Date DATE;
    begin
    -- Initialize the date
    test_Date := to_date('12/12/2008 12:12:23','DD/MM/YYYY HH12:MI:SS');
    --To display date in DATE
    dbms_output.put_line('DATE : '|| test_Date);
    --To display date in TIMESATMP format
    dbms_output.put_line('TIMESTAMP: ' || CAST(test_Date AS TIMESTAMP));
  end;
/

DATE : 12-DEC-08
TIMESTAMP: 12-DEC-08 12.12.23.000000000 PM

PL/SQL procedure successfully completed

SQL>

Another example using SYSTIMESTAMP

SQL> select systimestamp from dual;
SYSTIMESTAMP
20-NOV-08 05.55.31.081000 PM +05:30

SQL>

Read,

Technorati Tags:
, ,

0 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 0 Buffer 0 Email -- Filament.io 0 Flares ×

One thought on “Oracle DATE vs TIMESTAMP |Comparing Oracle DATE and TIMESTAMP Datatypes

  1. Pingback: Oracle timestamp format milliseconds| Oracle Date format | SQL and PLSQL

Leave a Reply

Your email address will not be published. Required fields are marked *

Paged comment generated by AJAX Comment Page