December 20, 2012

Get Date A Year Before & A Year After in AX

To get date after1 year from a date in Microsoft Dynamics AX, we can use function "nextYr(date _date)" and we can use function "prevYr(date _date)" to get 1 year before. For example, we use example date "December 11th 2012". This is an example to apply it :

Static Void PrevNextYear_test()
{
    date      testDate = str2date("12/11/2013", 123);
    ;
    info(strfmt("This Date : %1, 1 Year After : %2", testDate, nextYr(testDate)));
    info(strfmt("This Date : %1, 1 Year Before : %2", testDate, prevYr(testDate)));
}

The result from above job is like this :


0 comments:

Post a Comment