sql date functions

From: BD Postgres <postgres(at)master(dot)abrente(dot)es>
To: pgsql-sql(at)postgresql(dot)org
Subject: sql date functions
Date: 1998-07-06 10:14:29
Message-ID: 35A0A385.BE14761A@master.abrente.es
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello,

I am new to postgress and SQL and I don't know how to use the date
functions:
I need to insert two dates in a row, the first been a week before the
second but I don't know how this can be achieved, I have tried:

insert into table1 (date1,date2) values('1997-2-3::date','1997-2-3::date
+ timespan(1 week)');

that is what I think that should be, and all the variations I have
imagined, but it hasn't worked, I'm doing this from perl with the DBI
interface, but I don't think that to precompute the second date first in
perl is a good idea, I prefer to let postgress do it if possible.

the errors reported by postmaster are like this:
ERROR: Bad date external representation 1/2/2003::date + timespan(1
week)

Could somebody tell me which is the correct way to get this working ?

Thank you.

- Salvador Fandiño.

P.S. I have previusly posted this msg in the NOVICE mailing list, but
nobody seems to know how to do it there.

Browse pgsql-sql by date

  From Date Subject
Next Message BD Postgres 1998-07-06 11:09:22 Re: [SQL] sql date functions
Previous Message Korapat Charukumnerdkanok 1998-07-06 09:31:31 :) Import file2table Question