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



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/PostgreSQL/clock_timestamp-function.php