Re: Obtaining the Julian Day from a date

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
Cc: Bruno Wolff III <bruno(at)wolff(dot)to>, pgsql-general(at)postgresql(dot)org
Subject: Re: Obtaining the Julian Day from a date
Date: 2004-09-11 18:09:43
Message-ID: 19681.1094926183@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Karl O. Pinc" <kop(at)meme(dot)com> writes:
> RETURN day_zero + CAST (julian_day || ' days' AS INTERVAL);

That's certainly the hard way. Just use the date + integer operator
(ie, "RETURN day_zero + julian_day").

> day_zero CONSTANT DATE := CAST (0 AS DATE);

Does that really work? I get

regression=# select CAST (0 AS DATE);
ERROR: cannot cast type integer to date

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Karl O. Pinc 2004-09-11 18:20:29 Re: Obtaining the Julian Day from a date
Previous Message Karl O. Pinc 2004-09-11 18:09:23 Re: pass an array as parameter to a function