Skip site navigation (1) Skip section navigation (2)

Re: julian day function

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: doj(at)wwws2(dot)redaex(dot)de
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: julian day function
Date: 2001-02-02 14:17:46
Message-ID: 3A7AC18A.84F1808C@alumni.caltech.edu (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-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

In response to

Responses

pgsql-hackers by date

Next:From: Nathan MyersDate: 2001-02-02 16:34:18
Subject: Re: configure problem with krb4 and ssl when compiling 7.1beta4
Previous:From: Thomas LockhartDate: 2001-02-02 14:00:33
Subject: Re: A Sparc/Linux patch (for 7.1), and a Linux rc.d/init.dscript....

pgsql-patches by date

Next:From: Ryan KirkpatrickDate: 2001-02-03 01:58:51
Subject: Re: A Sparc/Linux patch (for 7.1), and a Linux rc.d/init.d script....
Previous:From: Thomas LockhartDate: 2001-02-02 14:00:33
Subject: Re: A Sparc/Linux patch (for 7.1), and a Linux rc.d/init.dscript....

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group