Nav 2009 r2 Date Calculation


I am new in Nav development. Currently I faced the problem of date development.

I would like to know how to add the month to a date and get the result.

For example:

employdate:= 01-01-2014;

ProbationPeriod := 3;

endofprobation := employdate + ProbationPeriod; //result: 31-03-2014

Please help. Thanks.


newDate := CALCDATE(’-CM+3M-1D’);

Thanks Jonathan for the solution. this is work!
By the way, another question, do you have idea how to set the range by select only the month? I need it to generate the report.

For example,

month: 10 //selected by user

Then fixed the date which is 21/9/2014 to 20/10/2014. (21st and 20th is fixed while month is selected by user and year is current year)

Thanks in advance.

warmest regards


currYear := DATE2DMY(TODAY,3);

startDate := DMY2DATE(21, Month - 1, currYear);

endDate := DMY2DATE(20, Month, currYear);

you’ll only need some additional code, if Month = 1 (i.e. January, so Month -1 = 0 → 12/ last year).