w3resource

PostgreSQL CURRENT_TIME() function

CURRENT_TIME() function

The PostgreSQL CURRENT_TIME() function returns the current time with time zone information.

Uses of CURRENT_TIME() Function
  • Retrieve Current Time: Get the current time with the time zone.

  • Time Comparisons: Use in SQL queries to compare with other time fields.

  • Time Calculations: Perform time arithmetic for intervals, durations, and other time-related calculations.

  • Report Generation: Generate reports with the current time.

  • Record Creation: Automatically set the creation time for new records.

Syntax:

current_time()

Return Type: time with time zone.

PostgreSQL Version: 9.3

Pictorial Presentation of PostgreSQL CURRENT_TIME() function

Pictorial presentation of postgresql CURRENT_TIME function

Example: PostgreSQL CURRENT_TIME() function

Code:

SELECT current_time;

Sample Output:

     timetz
-----------------
 16:33:22.719-08
(1 row)

N.B. - The outputs may change with current time.

Previous: CURRENT_DATE function
Next: CURRENT_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/current_time-function.php