Available in versions: Dev (3.20) | Latest (3.19) | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11 | 3.10

This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.

CURRENT_OFFSETDATETIME

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

Get the current server time as a SQL TIMESTAMP WITH TIME ZONE type (represented by java.time.OffsetDateTime).

This does the same as CURRENT_TIMESTAMP except that a cast is added, and the client type representation uses JSR-310 types.

SELECT current_timestamp;
create.select(currentOffsetDateTime()).fetch();

The result being something like

+-----------------------+
| current_timestamp     |
+-----------------------+
|   2020-02-03 15:30:45 |
+-----------------------+

Dialect support

This example using jOOQ:

currentOffsetDateTime()

Translates to the following dialect specific expressions:

Access

cstr(now())

ASE

CAST(current_bigdatetime() AS timestamp with time zone)

Aurora MySQL, ClickHouse, MariaDB, MemSQL, MySQL

CAST(current_timestamp() AS timestamp with time zone)

Aurora Postgres, DB2, Derby, DuckDB, Exasol, Firebird, H2, HSQLDB, Hana, Oracle, Postgres, Redshift, SQLite, Teradata, Trino, Vertica, YugabyteDB

CAST(CURRENT_TIMESTAMP AS timestamp with time zone)

BigQuery

CAST(CURRENT_TIMESTAMP AS timestamp)

CockroachDB

CAST(CURRENT_TIMESTAMP AS timestamptz)

Informix

CAST(CURRENT YEAR TO FRACTION (5) AS timestamp with time zone)

Snowflake

CAST(current_timestamp() AS timestamp_tz)

SQLDataWarehouse, SQLServer

CAST(CURRENT_TIMESTAMP AS datetimeoffset)

Sybase

CAST(CURRENT TIMESTAMP AS timestamp with time zone)
Generated with jOOQ 3.20. 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