Jump to: navigation, search

PostgreSQL JUSTIFY INTERVAL

From w3cyberlearnings

Contents

Postgresql justify_interval

Adjust interval using justify_days and justify_hours, with additional sign adjustments.

Syntax justify_interval

justify_interval(interval);

Example 1


postgres=# SELECT justify_interval(interval '3 months 192 days');
 justify_interval 
------------------
 9 mons 12 days
(1 row)

postgres=# SELECT justify_interval(interval '3400 seconds');
 justify_interval 
------------------
 00:56:40
(1 row)

Example 2

postgres=# SELECT justify_interval(interval '42 minutes 304 seconds');
 justify_interval 
------------------
 00:47:04
(1 row)

Example 3

 
postgres=# SELECT justify_interval(interval '420 days');
 justify_interval 
------------------
 1 year 2 mons
(1 row)

Related Links



Navigation
Web
SQL
MISC
References