# Nav 2009 r2 Date Calculation

**URL:** <https://www.dynamicsuser.net/t/nav-2009-r2-date-calculation/55852>\
**Category:** Developers Forum\
**Created:** [November 17, 2014, 4:01am UTC](https://www.dynamicsuser.net/t/nav-2009-r2-date-calculation/55852 "2014-11-17T04:01:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![joankang](https://avatars.discourse-cdn.com/v4/letter/j/a6a055/32.png) [@joankang](https://www.dynamicsuser.net/u/joankang)\
**Post date:** [November 17, 2014, 4:01am UTC](https://www.dynamicsuser.net/t/nav-2009-r2-date-calculation/55852/1 "2014-11-17T04:01:39Z")

</div>

Hi,

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.

---

<div class="post-metadata">

**Author:** ![archer89](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@archer89](https://www.dynamicsuser.net/u/archer89)\
**Post date:** [November 17, 2014, 6:51am UTC](https://www.dynamicsuser.net/t/nav-2009-r2-date-calculation/55852/2 "2014-11-17T06:51:53Z")

</div>

hi,

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

---

<div class="post-metadata">

**Author:** ![joankang](https://avatars.discourse-cdn.com/v4/letter/j/a6a055/32.png) [@joankang](https://www.dynamicsuser.net/u/joankang)\
**Post date:** [November 17, 2014, 9:03am UTC](https://www.dynamicsuser.net/t/nav-2009-r2-date-calculation/55852/3 "2014-11-17T09:03:59Z")

</div>

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

joan

---

<div class="post-metadata">

**Author:** ![archer89](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@archer89](https://www.dynamicsuser.net/u/archer89)\
**Post date:** [November 17, 2014, 10:10am UTC](https://www.dynamicsuser.net/t/nav-2009-r2-date-calculation/55852/4 "2014-11-17T10:10:20Z")

</div>

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).
