Re: convert interval info into days

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: "Johnson, Shaunn" <SJohnson6(at)bcbsm(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: convert interval info into days
Date: 2003-08-22 19:36:19
Message-ID: 20030822193619.GA32145@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Aug 22, 2003 at 13:00:57 -0400,
"Johnson, Shaunn" <SJohnson6(at)bcbsm(dot)com> wrote:
> Howdy:
>
> I want to convert all of this into days, but
> I don't think I can use 'to_char' because
> I get things like this:

Converting intervals to days is a problem because months are treated as
having 30 days if you try to extract the number of seconds from the
interval (which could then be converted to days). If you have a base
date the interval is relative to, then I think you can get what you
want by extract the epoch from (base_date + interval) - base_date and
then divide by 24*60*60.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Rawnsley 2003-08-22 19:48:45 Re: Single-file DBs WAS: Need concrete "Why Postgres
Previous Message Denis Komninakis Diniz 2003-08-22 19:35:32 difficulties in extracting data type.