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 20040911013254.GA9447@wolff.to
Whole thread Raw
In response to Re: Obtaining the Julian Day from a date  ("Karl O. Pinc" <kop@meme.com>)
Responses Re: Obtaining the Julian Day from a date  ("Karl O. Pinc" <kop@meme.com>)
List pgsql-general
On Thu, Sep 09, 2004 at 16:32:18 -0500,
  "Karl O. Pinc" <kop@meme.com> wrote:
>
> 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.)

If you keep your data in a date field you can get the Julian day
by subtracting the appropiate date. You can then do mod on this
difference.

You could also do the subtraction before storing the data if you want
to keep it internally as Julian days.

pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: 8.0.0beta2: gcc: unrecognized option `-pthreads'
Next
From: Randy Yates
Date:
Subject: Another Security Question: User-based Roles vs. Application Business Rules