Search Postgresql Archives

Re: Date Math

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 -------------- Original message ----------------------
From: Rich Shepard <rshepard@xxxxxxxxxxxxxxx>
> On Mon, 7 May 2007, aklaver@xxxxxxxxxxx wrote:
> 
> > test=> select '01/01/04'::date +interval '3 year',current_date + interval
> > '2 month';
> >      ?column?       |      ?column?
> > ---------------------+---------------------
> > 2007-01-01 00:00:00 | 2007-07-07 00:00:00
> > (1 row)
> 
> Adrian,
> 
>    I think so, but without explicit strings. The dates and intervals are in
> the table, and I want the rows that meet the specified conditions.
> 
>    Is the following closer to correct?
> 
>    SELECT ... FROM Permits
>      WHERE (date_issued::DATE + INTERVAL term)
>          < (CURRENT_DATE + INTERVAL process_time + INTERVAL '2 week')
> 
> Thanks,
> 
> Rich

If term and process_time are stored as intervals then it will work. Also if they are stored as
INTERVALS you can do CURRENT_DATE+process_time. In other words not have to declare the 
INTERVAL . Is date_issued stored as a date? If so it would not need to be cast.
--
Adrian Klaver
aklaver@xxxxxxxxxxx


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux