PostgreSQL justify_hours() Function

The PostgreSQL justify_hours() function converts the representation of time intervals, converting hours over 24 hours into days.

justify_hours() Syntax

Here is the syntax of the PostgreSQL justify_hours() function:

justify_hours(value INTERVAL) -> INTERVAL

Parameters

value

Required. The interval value to convert.

Return value

The PostgreSQL justify_hours() function converts the representation of time intervals, converting hours over 24 hours into days.

If the given interval value is less than 24 days, no conversion will be done.

justify_hours() Examples

The following example shows the basic usage of the justify_hours() function.

SELECT
    justify_hours(INTERVAL '20 hours') AS "20 hours",
    justify_hours(INTERVAL '60 hours') AS "60 hours";
 20 hours |    60 hours
----------+-----------------
 20:00:00 | 2 days 12:00:00