diffdate

Declaration

integer function diffdate(date D, date D1,Integer t)

Description

diffdate returns the difference between dates D and D1. The units of time that diffdate returns is controlled by Integer t where t can be :

value return units

4 days

3 hours

2 minutes

1 seconds

0 milliseconds

Example Stored Procedure

CREATE PROCEDURE test_diffdate (X date, Y date, Z Integer)

RETURNS (result INTEGER) AS

BEGIN

result = diffdate(X,Y,z);

END!!

WISQL - calling the example stored procedure

execute procedure test_diffdate("12/12/96 1:2:59", "2/12/96 1:2:59",4)

RESULT

===========

304

execute procedure test_diffdate("12/12/96 1:2:59", "2/12/96 1:2:59",3)

RESULT

===========

7296

execute procedure test_diffdate("12/12/96 1:2:59", "2/12/96 1:2:59",2)

RESULT

===========

437760

execute procedure test_diffdate("12/12/96 1:2:59", "2/12/96 1:2:59",1)

RESULT

===========

26265600

execute procedure test_diffdate("12/12/96 1:2:59", "2/12/96 1:2:59",0)

RESULT

===========

66299494

Error Results - restrictions on t are : 0 <= t <=4Y

execute procedure test_diffdate("12/12/96 1:2:59", "2/12/96 1:2:59",5)

RESULT

===========

-999999