w3resource

PostgreSQL TIMEOFDAY() function

TIMEOFDAY() function

The PostgreSQL TIMEOFDAY() function is used to get current date and time (like clock_timestamp, but as a text string).

Uses of TIMEOFDAY() Function
  • Retrieve the current date and time in a readable text format.

  • Useful for logging and displaying the current timestamp in a human-readable form.

  • Provides an easy way to capture the exact time of an event or transaction for reporting purposes.

Syntax:

timeofday()

Return Type: text

PostgreSQL Version: 9.3

Pictorial Presentation

Pictorial presentation of PostgreSQL TIMEOFDAY() function

Example: PostgreSQL TIMEOFDAY() function

Code:

SELECT timeofday();

Sample Output:

              timeofday
-------------------------------------
 Thu Jan 15 14:47:28.937000 2015 PST
(1 row)

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

Previous: STATEMENT_TIMESTAMP function
Next: TRANSACTION_TIMESTAMP 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://www.w3resource.com/PostgreSQL/timeofday-function.php