I would have thought this should return a difference of 31 days, instead it returns 100. I don't know why it does this.
To get around this issue I tried the following:
-SET &dateDiff = DATEDIF('01 MAR 2010', '01 APR 2010', 'D');
This worked correctly and calculated the difference as 31 days. However, I need to pass these dates into the DATEDIF function as variables. The first date is when the report was created, the second the current date. To do this I've used the following:
-* the first date -SET &startDate = '20100401';
-* get the current date -SET ¤tDate = TODAY(A10);
-* format the current date -SET ¤tDate = EDIT(¤tDate,'$$$$$$9999')|EDIT(¤tDate,'99')|EDIT(¤tDate,'$$$99');
(FOC36355) INVALID TYPE OF ARGUMENT #2 FOR USER FUNCTION DATEDIF
It doesn't appear to like me passing in the date in variables if its of the format '01 APR 2010'
I'm now stumped.
I would be grateful for any assistance you can provide.
Thanks
MichealThis message has been edited. Last edited by: Kerry,
April 08, 2010, 07:18 AM
Dan Satchell
If you use date strings instead of Smart Dates, function DATEDIF requires separators between the year, month, and day portions of the date string, and single quotes around the entire string. The code below seems to work.