Available in versions: Dev (3.21) | Latest (3.20) | 3.19 | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11
TIMESTAMP (Timestamp)
Supported by ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
The TIMESTAMP
data type represents a local date time type, or java.sql.Timestamp
in Java, or Types.TIMESTAMP
in JDBC.
Some dialects support an explicit precision flag on this data type. If absent, the default is dialect specific.
For historic reasons, this data type was also capable of representing a TIMESTAMP WITH TIME ZONE data type in JDBC, by making complicated use ofjava.util.Calendar
when binding the type to ajava.sql.PreparedStatement
, or reading it from ajava.sql.ResultSet
. jOOQ, however, treats it as ajava.time.LocalDateTime
as suggested by various methods on the type, such asTimestamp.valueOf(LocalDateTime)
or, more importantly,Timestamp.valueOf(String)
, which is not capable of parsing time zone information.
createTable("t").column("c", TIMESTAMP)
Translates to the following dialect specific expressions:
Access, Aurora MySQL, BigQuery, MemSQL, MySQL, SQLDataWarehouse, SQLite
CREATE TABLE t ( c datetime )
ASE, MariaDB, Sybase
CREATE TABLE t ( c datetime NULL )
Aurora Postgres, CockroachDB, DB2, Derby, DuckDB, Exasol, Firebird, H2, HSQLDB, Hana, Oracle, Postgres, Redshift, Teradata, Trino, Vertica, YugabyteDB
CREATE TABLE t ( c timestamp )
ClickHouse
CREATE TABLE t ( c Nullable(timestamp) ) ENGINE Log()
Databricks
CREATE TABLE t ( c timestamp_ntz ) TBLPROPERTIES( 'delta.columnMapping.mode' = 'name', 'delta.feature.allowColumnDefaults' = 'supported' )
Informix
CREATE TABLE t ( c datetime year to fraction(5) )
Snowflake
CREATE TABLE t ( c timestamp_ntz )
SQLServer
CREATE TABLE t ( c datetime2 )
Generated with jOOQ 3.21. Support in older jOOQ versions may differ. Translate your own SQL on our website
cast(field("c"), TIMESTAMP)
Translates to the following dialect specific expressions:
Access
cdate(c)
ASE, Aurora MySQL, BigQuery, MariaDB, MemSQL, MySQL, SQLDataWarehouse, SQLite, Sybase
CAST(c AS datetime)
Aurora Postgres, CockroachDB, DB2, Derby, DuckDB, Exasol, Firebird, H2, HSQLDB, Hana, Oracle, Postgres, Redshift, Teradata, Trino, Vertica, YugabyteDB
CAST(c AS timestamp)
ClickHouse
CAST(c AS Nullable(timestamp))
Databricks, Snowflake
CAST(c AS timestamp_ntz)
Informix
CAST(CAST(c AS datetime year to fraction(5)) AS datetime year to fraction(5))
SQLServer
CAST(c AS datetime2)
Generated with jOOQ 3.21. Support in older jOOQ versions may differ. Translate your own SQL on our website
Feedback
Do you have any feedback about this page? We'd love to hear it!