Date and Time Data Types

From InterBase
Jump to: navigation, search

Go Up to Specifying Data Types


InterBase supports DATE,TIME and TIMESTAMP data types.

  • DATE stores a date as a 32-bit longword. Valid dates are from January 1, 100 a.d. to February 29, 32768 a.d.
  • TIME stores time as a 32-bit longword. Valid times are from 00:00 AM to 23:59.9999 PM.
  • TIMESTAMP is stored as two 32-bit longwords and is a combination of DATE and TIME.

The following statement creates TIMESTAMP columns in the SALES table:

CREATE TABLE SALES
 (. . .
 ORDER_DATE TIMESTAMP
 DEFAULT 'now'
 NOT NULL,
 SHIP_DATE TIMESTAMP
 CHECK (SHIP_DATE >= ORDER_DATE OR SHIP_DATE IS NULL),
 . . .);

In the previous example, NOW returns the system date and time.

Topics