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 WITH TIME ZONE (OffsetDateTime)

Supported by ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

The TIMESTAMP WITH TIME ZONE data type represents an offset date time type, or java.time.OffsetDateTime in Java, or Types.TIMESTAMP_WITH_TIMEZONE in JDBC.

Some dialects support an explicit precision flag on this data type. If absent, the default is dialect specific.

JDBC's standardisation of this type to java.time.OffsetDateTime is controversial as it is arguably the least useful representation of a "timestamp with time zone", compared to java.time.Instant (supported by jOOQ via INSTANT (Instant)) or java.time.ZonedDateTime (not currently supported by jOOQ, out of the box.) Users can override jOOQ's default by applying a Forced type configuration to their code generation setup, if they wish to change the default behaviour.

DDL support

Dialect support

This example using jOOQ:

createTable("t").column("c", TIMESTAMPWITHTIMEZONE)

Translates to the following dialect specific expressions:

Access, Aurora MySQL, Aurora Postgres, DB2, Derby, DuckDB, Exasol, Firebird, H2, HSQLDB, Hana, Informix, MariaDB, MemSQL, MySQL, Oracle, Postgres, Redshift, SQLite, Teradata, Trino, Vertica, YugabyteDB

CREATE TABLE t (
  c timestamp with time zone
)

ASE, Sybase

CREATE TABLE t (
  c timestamp with time zone NULL
)

BigQuery

CREATE TABLE t (
  c timestamp
)

ClickHouse

CREATE TABLE t (
  c Nullable(timestamp with time zone)
)
ENGINE Log()

CockroachDB

CREATE TABLE t (
  c timestamptz
)

Databricks

CREATE TABLE t (
  c timestamp
)
TBLPROPERTIES(
  'delta.columnMapping.mode' = 'name',
  'delta.feature.allowColumnDefaults' = 'supported'
)

Snowflake

CREATE TABLE t (
  c timestamp_tz
)

SQLDataWarehouse, SQLServer

CREATE TABLE t (
  c datetimeoffset
)
Generated with jOOQ 3.21. Support in older jOOQ versions may differ. Translate your own SQL on our website

Cast support

Dialect support

This example using jOOQ:

cast(field("c"), TIMESTAMPWITHTIMEZONE)

Translates to the following dialect specific expressions:

Access

cstr(c)

ASE, Aurora MySQL, Aurora Postgres, DB2, Derby, DuckDB, Exasol, Firebird, H2, HSQLDB, Hana, Informix, MariaDB, MemSQL, MySQL, Oracle, Postgres, Redshift, SQLite, Sybase, Teradata, Trino, Vertica, YugabyteDB

CAST(c AS timestamp with time zone)

BigQuery, Databricks

CAST(c AS timestamp)

ClickHouse

CAST(c AS Nullable(timestamp with time zone))

CockroachDB

CAST(c AS timestamptz)

Snowflake

CAST(c AS timestamp_tz)

SQLDataWarehouse, SQLServer

CAST(c AS datetimeoffset)
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!

The jOOQ Logo