pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedinterval +variable
3+ messages / 3 participants
[nested] [flat]
* interval +variable
@ 2005-03-09 08:58 Fatih Cerit <fatih@intersan.com.tr>
2005-03-09 09:17 ` Re: interval +variable Michael Fuhr <mike@fuhr.org>
2005-03-09 14:19 ` Re: interval +variable Bruno Wolff III <bruno@wolff.to>
0 siblings, 2 replies; 3+ messages in thread
From: Fatih Cerit @ 2005-03-09 08:58 UTC (permalink / raw)
To: pgsql-sql
Dear all
Is there anyone at there who knows howto use dateadd in pgsql. I have a
problem in my function that is like this ;
Select into futuredate now() + interval '30 days'; <- this is ok
but how can I use a variable intead of '30 days' :(
Thanks
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: interval +variable
2005-03-09 08:58 interval +variable Fatih Cerit <fatih@intersan.com.tr>
@ 2005-03-09 09:17 ` Michael Fuhr <mike@fuhr.org>
1 sibling, 0 replies; 3+ messages in thread
From: Michael Fuhr @ 2005-03-09 09:17 UTC (permalink / raw)
To: Fatih Cerit <fatih@intersan.com.tr>; +Cc: pgsql-sql
On Wed, Mar 09, 2005 at 10:58:05AM +0200, Fatih Cerit wrote:
> Is there anyone at there who knows howto use dateadd in pgsql. I have a
> problem in my function that is like this ;
>
> Select into futuredate now() + interval '30 days'; <- this is ok
> but how can I use a variable intead of '30 days' :(
Are you looking for something like this?
ndays := 30;
SELECT INTO futuredate now() + ndays * interval'1 day';
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: interval +variable
2005-03-09 08:58 interval +variable Fatih Cerit <fatih@intersan.com.tr>
@ 2005-03-09 14:19 ` Bruno Wolff III <bruno@wolff.to>
1 sibling, 0 replies; 3+ messages in thread
From: Bruno Wolff III @ 2005-03-09 14:19 UTC (permalink / raw)
To: Fatih Cerit <fatih@intersan.com.tr>; +Cc: pgsql-sql
On Wed, Mar 09, 2005 at 10:58:05 +0200,
Fatih Cerit <fatih@intersan.com.tr> wrote:
> Dear all
>
> Is there anyone at there who knows howto use dateadd in pgsql. I have a
> problem in my function that is like this ;
>
> Select into futuredate now() + interval '30 days'; <- this is ok
> but how can I use a variable intead of '30 days' :(
A better solution may to be to use the date type instead of the timestamp type.
Then you can just add an integer number to the date. You also don't have
to worry about daylight savings time changes.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2005-03-09 14:19 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-03-09 08:58 interval +variable Fatih Cerit <fatih@intersan.com.tr>
2005-03-09 09:17 ` Michael Fuhr <mike@fuhr.org>
2005-03-09 14:19 ` Bruno Wolff III <bruno@wolff.to>
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