w3resource

PostgreSQL TRANSACTION

TRANSACTION_TIMESTAMP() function

The PostgreSQL TRANSACTION_TIMESTAMP() function is used to get the current date and time at the start of the current transaction.

Uses of TRANSACTION_TIMESTAMP() Function
  • Retrieve the timestamp at the start of a transaction.

  • Useful for tracking the time when a transaction began.

  • Helps in maintaining consistent timing information within a transaction.

  • Can be used for logging and debugging transaction-related events.

Syntax:

timeofday()

Return Type: text

PostgreSQL Version: 9.3

Pictorial Presentation of PostgreSQL TRANSACTION_TIMESTAMP() function

Pictorial presentation of PostgreSQL TRANSACTION_TIMESTAMP() function

Example: PostgreSQL TRANSACTION_TIMESTAMP() function

Code:

SELECT timeofday();

Sample Output:

   transaction_timestamp
----------------------------
 2015-01-15 14:57:22.598-08
(1 row)

N.B. - The outputs may change during the execution for the current date.

Previous: TIMEOFDAY function
Next: Mathematical and Trigonomitecal functions Introduction



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/transaction_timestamp-function.php