justify_interval()

用于调整时间间隔中天和小时单位的函数

justify_interval() 是一个系统函数,用于将 interval 类型中的天数和小时数分别调整为月数和天数。

justify_interval()PostgreSQL 8.2 中添加。

用法

justify_interval ( interval ) → interval

justify_interval() 有效地结合了 justify_days()justify_hours() 的功能。

变更历史

示例

justify_interval() 的基本用法示例

postgres=# SELECT justify_interval('43 days 28 hours');
    justify_interval    
------------------------
 1 mon 14 days 04:00:00
(1 row)

请注意,与 justify_days() 一样,一个月被视为 30 天,这可能会导致潜在的误导性输出。

postgres=# SELECT justify_interval('364 days 24 hours');
 justify_interval 
------------------
 1 year 5 days
(1 row)

分类

日期和时间, 系统函数

另请参阅

justify_days(), justify_hours()

反馈

就“justify_interval()”提交任何评论、建议或更正 请在此处