How to check whether the date is valid or not
How to check whether the date is valid or not
(OP)
Hi,
I'm using a procedure in which i have to append the date by 1 unit, everytime the loop increases. I need to check whether the new processed date is valid or not. for eg: suppose my current date is 2007-02-28. on adding 1 it is giving me 2007-02-29. i hv to check whether it is a valid date or not thru a function. how can it be done..?? is there any inbuilt mechanism to check
I'm using a procedure in which i have to append the date by 1 unit, everytime the loop increases. I need to check whether the new processed date is valid or not. for eg: suppose my current date is 2007-02-28. on adding 1 it is giving me 2007-02-29. i hv to check whether it is a valid date or not thru a function. how can it be done..?? is there any inbuilt mechanism to check
RE: How to check whether the date is valid or not
But 1+DATE('2007-02-28') simply gives 2007-03-01
Hope This Helps, PH.
FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?
RE: How to check whether the date is valid or not
***********************************************************
If fLastStmtDate1 Is Null Then
Let fLastStmtDate1 = Date(fStmtNextDate) - 1 Units Month;
End If;
Let fLastStmtDate2 = Date(fLastStmtDate1) + 1 Units Day;
***********************************************************
and in this part it is giving me the error -1267.. I am not gettign nay clue why this error is coming
RE: How to check whether the date is valid or not
I'd use a separate procedure for adding/subtracting months:
CODE
DEFINE res DATE; DEFINE nbj SMALLINT;
LET nbj=0;
WHILE 1=1
ON EXCEPTION IN(-1267)
LET nbj=nbj+1;
END EXCEPTION
LET res=DATE(dep-nbj UNITS DAY + nbm UNITS MONTH);
EXIT WHILE;
END WHILE
RETURN res;
END PROCEDURE;
CODE
Let fLastStmtDate1 = AddMonth(fStmtNextDate,-1);
End If;
Hope This Helps, PH.
FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?