w3resource

PostgreSQL CLOCK_TIMESTAMP() function

CLOCK_TIMESTAMP() function

The PostgreSQL CLOCK_TIMESTAMP() function returns the current date and time, which changes during the statement execution.

Uses of CLOCK_TIMESTAMP() Function
  • Current Timestamp: Retrieve the current date and time with time zone information.

  • Real-Time Data: Useful for capturing real-time timestamps in applications.

  • Logging: Record precise timestamps for logging purposes.

  • Time-Sensitive Operations: Perform operations requiring the exact current time during execution.

Syntax:

clock_timestamp()

Return Type: timestamp with time zone.

PostgreSQL Version: 9.3

Pictorial Presentation of PostgreSQL CLOCK_TIMESTAMP() function

Pictorial presentation of PostgreSQL CLOCK_TIMESTAMP() function

Example: PostgreSQL CLOCK_TIMESTAMP() function

Code:

SELECT clock_timestamp();

Sample Output:

      clock_timestamp
----------------------------
 2015-01-14 15:49:26.086-08
(1 row)

N.B. - The outputs depending upon the current date and time.

Previous: AGE function
Next: CURRENT_DATE function



Follow us on Facebook and Twitter for latest update.