Subject Re: [firebird-support] Date functions
Author Ann W. Harrison
reinaldo_mra wrote:
> I did not find any function to add a value to a timestamp column. I need
> something like that:
>
> SELECT * FROM Table WHERE TimeStampColumn<=AddMonth( NOW, 5)
> SELECT * FROM Table WHERE TimeStampColumn<=AddDay( NOW, 5)
> SELECT * FROM Table WHERE TimeStampColumn<=AddHour( NOW, 5)
>

In inverse order...

hours:

select * from table
where timestampcolumn <=
cast ('now' as timestamp) + (5.00 / 24.00)

days:

select * from table
where timestampcolumn <=
cast ('now' as timestamp) + (5.00)

months is tricky, since they're variable legth

select * from table
where timestampcolumn <=
cast ('now' as timestamp) + (5.00 * 365.0/12.0)


Regards


Ann