Re: Obtaining the Julian Day from a date - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: Obtaining the Julian Day from a date
Date
Msg-id 20040909191106.GA30916@wolff.to
Whole thread Raw
In response to Obtaining the Julian Day from a date  ("Karl O. Pinc" <kop@meme.com>)
List pgsql-general
On Thu, Sep 09, 2004 at 12:35:14 -0500,
  "Karl O. Pinc" <kop@meme.com> wrote:
> Hi,
>
> What's the best way to obtain the Julian day from a postgresql
> date?
>
> PostgreSQL 7.3.4 on i386-redhat-linux-gnu, compiled by GCC
> i386-redhat-linux-gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
>
> I'm doing some date arithmetic with 1 day intervals and want
> to, for example, round to the even Julian day.  I suppose
> I could always take the interval from julian day zero
> and then divide by the number of seconds in a day, but that
> sounds both brutal and potentially inaccurate due to leap
> seconds and so forth.
>
> There's mention of being able to do  this in the list archives,
> but nobody says how it's actually done.

You might be interested to know that there are operators that combine
date and integer types that might be usable directly instead of
converting to Julian days.

pgsql-general by date:

Previous
From: pw
Date:
Subject: Where does postgres store records of DROP-ed columns?
Next
From: Aaron Birkland
Date:
Subject: Memory exhausted (leak?)