There is no function in AX which gives the date difference in words like 28 days 11 months and 2 years. Below job will help you to achieve this.
static void dateInWords(Args _args)
{
Date fromdate,todate,nxtDate;
int days,months,yr;
int rem;
;
fromdate = str2date(“10/20/2014”,213);
todate = str2date(“10/20/2015”,213);
nxtDate = nextMth(fromdate);
if(mthOfYr(fromDate) == mthOfYr(toDate) && year(fromdate) == year(toDate))
days = todate – fromDate;
while(nxtDate <= toDate)
{
months++;
days = todate – nxtDate;
nxtDate = nextMth(nxtDate);
}
rem = months MOD 12;
yr = months DIV 12;
print days,” days “,rem,” months “,yr,” years “;
pause;
}
hi
nice blog very informative