↑↓ select ↵ open ⌫ change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Functions / Date/Time Functions And Operators

clock_timestamp

Read the PG 18 manual

Current date and time (changes during statement execution); see Section 9.9.5

Reading PG 18current·documented in 21 of 27 versions, 8.2 to 20

Signatures & examples

clock_timestamp ( ) → timestamp with time zone
Current date and time (changes during statement execution); see Section 9.9.5
clock_timestamp() → 2019-12-23 14:39:53.662522-05
clock_timestamp()
transaction_timestamp() is equivalent to CURRENT_TIMESTAMP, but is named to clearly reflect what it returns. statement_timestamp() returns the start time of the current statement (more specifically, the time of receipt of the latest command message from the client). statement_timestamp() and transaction_timestamp() return the same value during the first statement of a transaction, but might differ during subsequent statements. clock_timestamp() returns the actual current time, and therefore its value changes even within a single SQL statement. timeofday() is a historical PostgreSQL function. Like clock_timestamp(), it returns the actual current time, but as a formatted text string rather than a timestamp with time zone value. now() is a traditional PostgreSQL equivalent to transaction_timestamp().
Version history 3
  1. 13 → 14 changed
  2. 12 → 13 changed
  3. 8.1 → 8.2 added

Definition snapshot: b7bd9cda · English manual source