Subject Re: [IBO] simple question
Author Helen Borrie
At 02:12 AM 19/08/2005 -0700, you wrote:
>Hello IBObjects,
>
> Maybe this is a silly question, but I really need
>help. I need to
> find the number of days that passed between two
>dates inside of a
> procedure. I know one way, by decomposing the dates
>in zz-mm-yyyy
> but, I try to find a simple way to do that... does
>anyone can help
> me find the right solution?! is this the best
>solution?!
> Looking forward....

Just subtract the later date from the earlier one. The result is the
interval in days.

create procedure GetInterval (date1 date, date2 date)
returns time_passed integer)
as
begin
time_passed = -1;
if (date2 < date1) then Exit;
time_passed = date2 - date1;
end

If you are comparing timestamp rather than date types, make the return
variable double precision.

Off-topic for IBO, by the way.

Helen