w3resource

PostgreSQL JUSTIFY_DAYS() function


JUSTIFY_DAYS() function

The PostgreSQL JUSTIFY_DAYS() function is used to adjust intervals so that 30-day time periods are represented as months.


Uses of JUSTIFY_DAYS() Function

  • Adjusts intervals with 30-day periods to be represented as months.

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

Syntax:

justify_days(interval)

Return Type:interval.

PostgreSQL Version: 9.3

Visual Presentation of PostgreSQL JUSTIFY_DAYS() function

Pictorial presentation of PostgreSQL JUSTIFY_DAYS() function


Example 1: PostgreSQL JUSTIFY_DAYS() function

SQL Code:

SELECT justify_days(interval '47 days');

Output:

 justify_days
---------------
 1 mon 17 days
(1 row)

Previous: ISFINITE function
Next: JUSTIFY_HOURS function



Follow us on Facebook and Twitter for latest update.