Subject Re: [ib-support] Problem with dates in SP
Author Helen Borrie
At 06:09 PM 19-08-02 +0200, Marco Lauria wrote:

> >select *
> >from bestelling
> >where leverdatum > current_date - 140
> >
> >Where leverdatum > currentdate - 140 days...
>
>I know this works!
>BUt I need to subtract a Time passed to a stored proc as a parameter!

Not really - a Time is a date/time data type. You need an Interval of
Elapsed time. What you need to pass as a parameter will be an integer or a
double, depending on whether you want to express this interval as years or
months or days (integer) or as smaller intervals....the unit of measurement
is based on day = 1, so...
years = n * 365 (approximately)
months = n * 12
days = n * 1

then

minutes = n * 1.000000/60
seconds = n * 1.000000/(60 * 60)

and so on.

heLen (up late again)

All for Open and Open for All
Firebird Open SQL Database · http://firebirdsql.org ·
http://users.tpg.com.au/helebor/
______________________________________________________________________