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

Re: julian day function

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: thomas(at)pgsql(dot)com
Cc: doj(at)wwws2(dot)redaex(dot)de, pgsql-patches(at)postgresql(dot)org
Subject: Re: julian day function
Date: 2001-02-05 07:02:49
Message-ID: Pine.LNX.3.96.1010205080118.20840A-100000@ara.zf.jcu.cz (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
On Fri, 2 Feb 2001, Thomas Lockhart wrote:

> > 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)

 ... and vice versa:

 test=# select to_timestamp('2451946', 'J');
      to_timestamp
------------------------
 2001-02-05 00:00:00+01
(1 row)

		Karel


In response to

pgsql-hackers by date

Next:From: Stephan SzaboDate: 2001-02-05 07:32:50
Subject: Re: Foreign Key Columns And Indices
Previous:From: Tom LaneDate: 2001-02-05 05:20:31
Subject: Re: Like vs '=' bug with indexing

pgsql-patches by date

Next:From: Dave PageDate: 2001-02-05 22:33:19
Subject: ODBC Driver bug fix patch
Previous:From: Tom LaneDate: 2001-02-05 05:06:05
Subject: Re: patch to allow btree indices on BYTEA

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