D365FO – How to add/subtract days and months from a date in X++

 

//Substract 1 day to Actual system date
DateTimeUtil::addDays(DateTimeUtil::getSystemDateTime(),-1) 

//Add 1 Month to Actual system date
DateTimeUtil::AddMonths(DateTimeUtil::getSystemDateTime(),-1) 

Comments