w3resource

PostgreSQL JUSTIFY_HOURS() function

JUSTIFY_HOURS() function

The PostgreSQL JUSTIFY_HOURS() function is used to adjust intervals so that 24-hour time periods are represented as days.

Uses of JUSTIFY_HOURS() Function
  • Converts intervals with 24-hour periods to be represented as days.

  • Simplifies interval representation by converting hours into days and remaining hours.

Syntax:

justify_hours(interval)

Return Type: interval.

PostgreSQL Version: 9.3

Pictorial Presentation of PostgreSQL JUSTIFY_HOURS() function

Pictorial presentation of PostgreSQL JUSTIFY_HOURS() function

Example: PostgreSQL JUSTIFY_HOURS() function:

Code:

SELECT justify_hours(interval '32 hours');

Sample Output:

 justify_hours
----------------
 1 day 08:00:00
(1 row)

Previous: JUSTIFY_DAYS function
Next: JUSTIFY_INTERVAL 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/justify_hours-function.php