Display time difference in hours in axapta

To Display time difference in hours in Axapta  you can use below code where timeConsumed is a method to get difference between from time and to time. You need to convert string to time first to get the right value.

 TimeofDay fromTime,toTime; // Time variables  
 ;  
  
 fromTime = str2time("8:50 am");  
 toTime = str2time("10:50 am");  
  
 info(strFmt("%1",timeConsumed(fromTime,toTime)));  

Comments