Re:

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: apratim sharma <hiapra(at)yahoo(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re:
Date: 2003-04-13 15:30:15
Message-ID: 27965.1050247815@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

apratim sharma <hiapra(at)yahoo(dot)com> writes:
> hi, Can anybody tell how to add an integer to a date inside postgres
> query. i'm using postgres 7.3 when i give select cast(now() as
> date) it gives the current date, now i want to select a date say after
> 10 days. i'm giving select cast(now() as date) +10 ; it gives error
> can't typecast date to int what to do??? please help me Apratim

Works for me:

regression=# select cast(now() as date) +10 ;
?column?
------------
2003-04-23
(1 row)

What PG version are you using, and are you sure that's exactly the
query you're issuing?

regards, tom lane

In response to

  • at 2003-04-13 06:19:47 from apratim sharma

Browse pgsql-jdbc by date

  From Date Subject
Next Message milimeter@163.com 2003-04-14 05:16:32 Problem about pgsql's column alias
Previous Message iran 2003-04-13 13:22:37 Need solution to decode data from bytea field