Matstand26
Matstand26

Reputation: 53

weird intervals in postgresql

I am working with postgresql and when i want to calcalute the average of some intervals between
two timestamps. The intervals are correct but I get something like "235 days 29:28:02.642857"
I find it strange that it says 235 days and 29 hours instead of 236 days and 5 hours.

Upvotes: 2

Views: 68

Answers (1)

Dodzia
Dodzia

Reputation: 21

As noted by @pozs, you can use justify_hours(interval) to get them converted properly. If you want to convert the days to months, you may use justify_days(interval). If you want to do both at once, do justify_interval(interval)

Upvotes: 2

Related Questions