web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :

Number of months between two dates in Dynamics ax 2012

Amir Nazim Profile Picture Amir Nazim 5,994

Recently I got a situation where I need to calculate the number of months between 2 dates, I found a built in method in dynamics ax 2012 that can be used.

noOfIntervals = intvNo(refDate, inputDate, intvScale::Month);

intvScale enumation have two values for months
Month
YearMonth

If we provide the intvScale::Month then X++ ignores the year and assumes that month is calculated within one year.

If we provide the intvScale::YearMonth then X++ calculate the number of months between different years. Consider following example.

There is another way to Calculates the difference between two dates in month units in Dynamics ax 2012 using method InfAdjValidation_MX::monthDifference(FromDate _fromDate, ToDate _toDate)



This was originally posted here.

Comments

*This post is locked for comments