TIMESTAMP data type

TIMESTAMP provides for storage of a combined DATE and TIME value. It permits a fractional-seconds value of up to nine digits.

See DATE data type and TIME data type.



Corresponding compile-time Java type


JDBC metadata type (java.sql.Types)


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]
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. The year, month, and day components must be positive integers.

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.


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')