Monday, 10 July 2017

Looping dates and finding months between the dates

static void LoopDates(Args _args)
{
    TransDate date1 = 15\8\2017;
    TransDate date2 = 21\10\2017;  
   
    while (mthOfYr(date1) <= mthOfYr(date2) || mthOfYr(date2) <= mthOfYr(date1))
    {
        info(strfmt("%1",mthName(mthOfYr(date1))));
        date1 = dateMthFwd(date1,1);

        if (mthOfYr(date1) == mthOfYr(date2))
        {
            info(strfmt("%1",mthName(mthOfYr(date1))));
            break;
        }
    }
}


No comments:

Post a Comment

Best Practices for Troubleshooting Application Issues in D365 and Power Platform

When facing application issues, it’s important to systematically troubleshoot before reaching out for support.  Follow these steps to ensure...