Re: Obtaining the Julian Day from a date - Mailing list pgsql-general

From Tom Lane
Subject Re: Obtaining the Julian Day from a date
Date
Msg-id 19681.1094926183@sss.pgh.pa.us
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
"Karl O. Pinc" <kop@meme.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

pgsql-general by date:

Previous
From: "Karl O. Pinc"
Date:
Subject: Re: Obtaining the Julian Day from a date
Next
From: "Karl O. Pinc"
Date:
Subject: Re: Obtaining the Julian Day from a date