AX2012 X++ Code to generate dates for one year

// Create a new job and paste the below code

static void RB_OneYearDate(Args _args)
{
    int           month,day,x,years,i,j,k;
    TransDate     preDate,nextmonth,monthStart,startdate,enddate,nextdate;

    ;

    years = year(systemdateget());
    for (i=1;i<=12;i++)
    {
      month = 0;
      nextmonth = mkDate(1,month+i,(years));
      enddate = endmth(nextmonth);
      day = dayofmth(enddate); 
     
      for(j=1; j<=day; j++)
      {
         month = mthofyr(nextmonth);
         nextdate = mkDate(j,month,(years));
         info(strfmt("%1",nextdate));
      }
    }
}

No comments:

Post a Comment