On 2004.09.09 14:11 Bruno Wolff III wrote:
> 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.
>
> 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.
Thanks. (It's not documented for 7.3 but works. It is documented
for 7.4.)
Unfortunately modulo (%) does not operate on dates so I still need
to convert to Julian day. :-( I need to know where I am within a
regular repeating interval. Mostly, in my case, modulo 2.
(We arbitrarly decided to begin our interval on Julian Day 0.)
Karl <kop@meme.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein