Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 The Oracle TIMESTAMP Datatype      [Return To Index] Jump to:  
  Looking for the original pages? (formerly called "Morgan's Library") You can find them here.

Term: TIMESTAMP

Definition:
When storing date and time information in Oracle, there are two basic options for the column's datatype: the DATE datatype and the TIMESTAMP datatype.

The DATE datatype has the ability to store the month, day, year, century, hours, minutes, and seconds. It has a resolution or granularity of 1 second. To distinguish or record events with a separation of less than 1 second, the TIMESTAMP datatype is required.

The TIMESTAMP datatype stores all of the information that the DATE datatype stores, but also includes fractional seconds.


Example of converting a DATE datatype to TIMESTAMP datatype:

SELECT CAST(date1 AS TIMESTAMP) "Date" FROM t;
Date
-----------------------------------------
15-APR-03 06.32.41.000000 PM
21-APR-03 12.42.26.000000 AM


Calculating the time difference between two TIMESTAMP datatypes is very straightforward- you just do straight subtraction of the two timestamp values.

When doing subtraction between dates, remember that the result is a value that represents the number of days. Multiply that number by the number of seconds in a day (86400) to determine the interval or value that you want to find.

For more detailed information on dates and timestamps, please see the Related Links below.


Related Links:

Related Code Snippets:
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 74 users online    © 2009 psoug.org
PSOUG LOGIN
Username: 
Password: 
Forgot your password?