Thursday, November 24, 2022

Get DateTime Difference between From & to date time field in D365 F&O X++

Here is the code to get Date Time field difference between from & To date time field. Output will be difference between Days, Hours , Mints & Seconds .

 int endDuration,dayCount,hourCount,mintCount,secCount,totalTimeVal,durationVal;
 TableName #TableNme; 

durationVal =  int642int(DateTimeUtil::getDifference(#TableNme.#EndDateTime,#TableNme.#StartDateTime )); totalTimeVal = 24*60*60; 
endDuration = durationVal; 
dayCount = endDuration / totalTimeVal; 
endDuration = endDuration - (dayCount * totalTimeVal ); 
hourCount = endDuration / 3600; 
endDuration = endDuration - (hourCount * 3600); 
mintCount = endDuration / 60 ; secCount = endDuration - (mintCount *60); 

 info(strFmt("%1 - Days, %2 - Hours ,%3 - Minutes , %4- Seconds",dayCount,hourCount,mintCount,secCount));

Conversion of Disposition code, code was not specified - Error in D365 F&O for inter company purchase order return

 We crated the return order for inter company purchase order  and created a Item Arrival Journal through Arrival Overview in corresponding c...