Subject Re: [firebird-support] Date functions
Author Alexandre Benson Smith
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)
> The number 5 can be 5 days, 5 hours or 5 months. It depends on context.
> Thanks,

Take a look on rFunc UDF library ( Mainly
these functions:
*IncDate*(d, i1, i2, i3) d 4-7 2.0.1 Change of date on i1 days, i2
months, i3 years.
*IncDateTime*(d, i1, i2, i3, i4, i5, i6) d 4-7 2.1.1 Change of date
on i1 days, i2 months, i3 years, i4 hours, i5 minutes, i6 seconds.

If you wish "business" month/year you could use a simple formula

TimeStamp = Float number, the integer part is the number of days since a
base date, decimal part is a fraction of a day, so 1 = 24 hours

1 minute = 1/24/60
1 hour = 1/24

see you !

Alexandre Benson Smith
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil