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

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 (view raw or flat)
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

pgsql-jdbc by date

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

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