# TIMESTAMP

TIMESTAMP stores a combined DATE and TIME value to be stored. It permits a fractional-seconds value of up to nine digits.

#### Syntax

    TIMESTAMP

#### Corresponding compile-time Java type

java.sql.Timestamp

#### JDBC metadata type (java.sql.Types)

TIMESTAMP

Dates, times, and timestamps cannot be mixed with one another in expressions.

Derby supports the following formats for TIMESTAMP:

    yyyy-mm-dd hh[:mm[:ss[.nnnnnn]]]
    yyyy-mm-dd-hh[.mm[.ss[.nnnnnn]]]

The first of the two formats above is the java.sql.Timestamp format.

The year must always have four digits. Months, days, and hours may have one or two digits. Minutes and seconds, if present, must have two digits. Nanoseconds, if present may have between one and six digits.

Derby also accepts strings in the locale specific datetime format, using the locale of the database server. If there is an ambiguity, the built-in formats above take precedence.

#### Examples

    VALUES '1960-01-01 23:03:20'
    VALUES TIMESTAMP('1962-09-23 03:23:34.234')
    VALUES TIMESTAMP('1960-01-01 23:03:20')

Parent topic: Data types
Related concepts
Built-In type overview
Numeric types
Related reference
Data type assignments and comparison, sorting, and ordering
BIGINT
BLOB
CHAR
CHAR FOR BIT DATA
CLOB
DATE
DECIMAL
DOUBLE
DOUBLE PRECISION
FLOAT
INTEGER
LONG VARCHAR
LONG VARCHAR FOR BIT DATA
NUMERIC
REAL
SMALLINT
TIME
VARCHAR
VARCHAR FOR BIT DATA
XML data type