Posts

Showing posts with the label DateTimeUtil

Futures class in Dynamics AX

Image
In Dynamics AX, if you want to find a date in a period, chances are you would be using the DateTimeUtil class. Say, I want to find the date 3 months exactly from today. Assuming a month is of 30 days, I can call the DateTimeUtil::addDays() method. So my code to get that will be, print DateTimeUtil::date(DateTimeUtil::addDays (DateTimeUtil::utcNow(), 3 * 30)); There is another application class in Dynamics AX, which does exactly this. This is the Futures class. Let us see this class in action. static void FuturesClass(Args _args) { Futures future; int i; // Setup a future class object with 365 days as a period future = new Futures(systemDateGet(), 365, PeriodUnit::Day); future.next(); info(strFmt("Future date after 3 months from today is %1",future.transDate())); // Setup a future class object with 1 year as a period future = new Futures(systemDateGet(), 1, PeriodUnit::Year); f...