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

Pictorial Presentation of PostgreSQL JUSTIFY_DAYS() function

Pictorial presentation of PostgreSQL JUSTIFY_DAYS() function

Example 1: PostgreSQL JUSTIFY_DAYS() function

Code:

SELECT justify_days(interval '47 days');

Sample Output:

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

Previous: ISFINITE function
Next: JUSTIFY_HOURS 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/justify_days-function.php