Quick Search:
 The Oracle TIMESTAMP Datatype      [Return To Index] Jump to:  


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:

15-APR-03 PM
21-APR-03 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 |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org