Appearance
JUSTIFY_DAYS, _HOURS, _INTERVAL
Adjust intervals that are expressed in days or hours and return their duration in months or days.
JUSTIFY_DAYS(interval)
JUSTIFY_HOURS(interval)
JUSTIFY_INTERVAL(interval)
- JUSTIFY_DAYS
Represent 30-day time periods as months.
- JUSTIFY_HOURS
Represent 24-hour time periods as days.
- JUSTIFY_INTERVAL
Represent days and hours as with the other JUSTIFY functions but apply additional plus or minus adjustments. For example:
interval '1 mon -1 hour'
- interval
If you specify a literal, the INTERVAL keyword is required. Yellowbrick does not support INTERVAL columns, so this value must be a valid interval literal in single quotes or a function that evaluates to an interval (such as MAKE_INTERVAL).
JUSTIFY_DAYS Example
premdb=# select JUSTIFY_DAYS(INTERVAL '40 days'), matchday,
matchday+JUSTIFY_DAYS(INTERVAL '40 days') matchday_plus_40
FROM match WHERE seasonid=20 AND htid=2 AND atid=55;
justify_days | matchday | matchday_plus_40
---------------+---------------------+---------------------
1 mon 10 days | 2012-02-04 00:00:00 | 2012-03-14 00:00:00
(1 row)
JUSTIFY_HOURS Example
premdb=# select JUSTIFY_HOURS(INTERVAL '48 hours'), matchday,
matchday+JUSTIFY_DAYS(INTERVAL '48 hours') matchday_plus_48hrs
FROM match WHERE seasonid=20 AND htid=2 AND atid=55;
justify_hours | matchday | matchday_plus_48hrs
---------------+---------------------+---------------------
2 days | 2012-02-04 00:00:00 | 2012-02-06 00:00:00
(1 row)
JUSTIFY_INTERVAL Example
premdb=# select JUSTIFY_INTERVAL(INTERVAL '40 days' + '8 hours'), matchday,
matchday+JUSTIFY_INTERVAL(INTERVAL '40 days' + '8 hours') matchday_plus_40days_plus_8hours
FROM match WHERE seasonid=20 AND htid=2 AND atid=55;
justify_interval | matchday | matchday_plus_40days_plus_8hours
------------------------+---------------------+----------------------------------
1 mon 10 days 08:00:00 | 2012-02-04 00:00:00 | 2012-03-14 08:00:00
(1 row)
Parent topic:Datetime Functions