Re: julian day function - Mailing list pgsql-patches

From Thomas Lockhart
Subject Re: julian day function
Date
Msg-id 3A7AC18A.84F1808C@alumni.caltech.edu
Whole thread Raw
In response to Re: A Sparc/Linux patch (for 7.1), and a Linux rc.d/init.d script....  (Ryan Kirkpatrick <pgsql@rkirkpat.net>)
Responses Re: julian day function
List pgsql-patches
> I have written a function to calculate the julian day from any gregorian day.
> You can include this code in the contrib directory or whatever place seems
> applicable in future releases of posgresql.

Looks nice!

There is already a j2date()/date2j() subroutine pair in the backend, to
support all of the existing date/time arithmetic. Would you be willing
to use calls to that? Then we wouldn't have two sets of code to maintain
(not that JD calculations change very often ;)

It would likely be helpful to have a, say, "julian" argument to
date_part(), which I'd be happy to add in. There is already access to
Julian date using the to_char(date,'J') function call, and you can get a
numeric type return using

  cast(to_char(date,'J') as int)

                          - Thomas

pgsql-patches by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: A Sparc/Linux patch (for 7.1), and a Linux rc.d/init.dscript....
Next
From: Ryan Kirkpatrick
Date:
Subject: Re: A Sparc/Linux patch (for 7.1), and a Linux rc.d/init.d script....