+ Start a Discussion

Difference between two dates in hour

Hello friend i am having a requirement in batch class two find difference between two fields in hours as well days. The data type of these two fields is Data Time one field name is "Email date" and other field name is "Current Date" and i need difference in Hours as well as in days


Any Help is Appreciated,


Minkesh Patel

Best Answer chosen by Admin (Salesforce Developers) 

Hi Minkesh,


here i have code which gives u difference in minute


Total number of minutes = (LastModifiedDate-CreatedDate)*24*60;


and also u can refere below link