PostgreSQL justify_interval() Function

The PostgreSQL justify_interval() function converts the representation of time intervals, converting hours over 24 hours into days, and days over 30 days into months.

The justify_interval() function is equivalent to a combination of the justify_days() function and the justify_hours() function.

justify_interval() Syntax

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

justify_interval(value INTERVAL) -> INTERVAL

Parameters

value

Required. The interval value to convert.

Return value

The PostgreSQL justify_interval() function converts the representation of time intervals, converting hours over 24 hours into days, and days over 30 days into months.

justify_interval() Examples

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

SELECT justify_interval(INTERVAL '6000 hours') AS "6000 hours";
   6000 hours
----------------
 8 mons 10 days