pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
date function problem
3+ messages / 3 participants
[nested] [flat]

* date function problem
@ 2004-02-03 15:51 mohan@physics.gmu.edu
  2004-02-03 16:01 ` Re: date function problem Larry Rosenman <ler@lerctr.org>
  2004-02-03 16:03 ` Re: date function problem Tomasz Myrta <jasiek@klaster.net>
  0 siblings, 2 replies; 3+ messages in thread

From: mohan@physics.gmu.edu @ 2004-02-03 15:51 UTC (permalink / raw)
  To: pgsql-sql

Hi All
I have an expiration_date column in my table with data type as timestamp.
I need to set that as one year after the current time. how do i do that. I
am getting a casting problem whenever i try something.

something like now()+ 1 year. Please let me know

--mohan





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: date function problem
  2004-02-03 15:51 date function problem mohan@physics.gmu.edu
@ 2004-02-03 16:01 ` Larry Rosenman <ler@lerctr.org>
  1 sibling, 0 replies; 3+ messages in thread

From: Larry Rosenman @ 2004-02-03 16:01 UTC (permalink / raw)
  To: mohan@physics.gmu.edu; pgsql-sql



--On Tuesday, February 03, 2004 10:51:45 -0500 mohan@physics.gmu.edu wrote:

> Hi All
> I have an expiration_date column in my table with data type as timestamp.
> I need to set that as one year after the current time. how do i do that. I
> am getting a casting problem whenever i try something.
>
> something like now()+ 1 year. Please let me know


 ler=# select now()+'1 year';
           ?column?
-------------------------------
 2005-02-03 10:00:40.913383-06
(1 row)

ler=#

ler=# select version();
                                            version
---------------------------------------------------------------------------
---------------------
 PostgreSQL 7.4.1 on i386-portbld-freebsd5.2, compiled by GCC cc (GCC) 
3.3.3 [FreeBSD] 20031106
(1 row)

ler=#


> --mohan
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faqs/FAQ.html
>



-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: date function problem
  2004-02-03 15:51 date function problem mohan@physics.gmu.edu
@ 2004-02-03 16:03 ` Tomasz Myrta <jasiek@klaster.net>
  1 sibling, 0 replies; 3+ messages in thread

From: Tomasz Myrta @ 2004-02-03 16:03 UTC (permalink / raw)
  To: pgsql-sql

Dnia 2004-02-03 16:51, Użytkownik mohan@physics.gmu.edu napisał:
> Hi All
> I have an expiration_date column in my table with data type as timestamp.
> I need to set that as one year after the current time. how do i do that. I
> am getting a casting problem whenever i try something.
> 
> something like now()+ 1 year. Please let me know

now()+'1 year'::interval

I suggest you reading more about interval datatype in documentation.

Regards,
Tomasz Myrta



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2004-02-03 16:03 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-02-03 15:51 date function problem mohan@physics.gmu.edu
2004-02-03 16:01 ` Larry Rosenman <ler@lerctr.org>
2004-02-03 16:03 ` Tomasz Myrta <jasiek@klaster.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox