TIMESTAMP data type

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[.nnnnnnnnn]
yyyy-mm-dd-hh.mm.ss[.nnnnnnnnn]
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 must have two digits. Nanoseconds, if present, may have between one and nine 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')
VALUES TIMESTAMP('1962-09-23-03:23:34.987654321')