Re: Inconsistent time interval formatting

From: Allen Chen <rocklob(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Gary Chambers <gwchamb(at)gwcmail(dot)com>, Ben Chobot <bench(at)silentmedia(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Inconsistent time interval formatting
Date: 2011-01-13 20:55:44
Message-ID: AANLkTik+cLNKp8Kdsh52_kEY9F755L0QmZaXU0ttQ+4T@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
> That won't really help. The fundamental point here is that '1 day' is
> not the same concept as '24 hours', because of DST changes; and the
> interval type treats them as different.
>
> If you don't care about that, you can use justify_hours (I think that's
> the right function) to smash them to the same thing.
>
> But I suspect the OP's real complaint would be better solved by use of
> to_char() to produce an output format that includes zeroes instead of
> dropping fields that are zero.
>
> regards, tom lane
>

Hi Tom,

I don't understand how DST changes matter for a time interval or how that
could even be factored into calculations. Could you elaborate on that? I
had a query today that returned an interval of 70:23:06.935933. Wouldn't
that be at least two days regardless of DST?

Thanks for shining the light on justify_hours, though. I did not know that
function existed. That does give me a way to have consistent output for
reporting.

Thanks to everyone who replied!

-Allen

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ben Chobot 2011-01-13 21:08:17 Re: Inconsistent time interval formatting
Previous Message Håvard Wahl Kongsgård 2011-01-13 20:51:42 Re: Performance on multiple OR conditions inside ()