+ Start a Discussion
minkeshminkesh 

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,

Thanks

Minkesh Patel

Best Answer chosen by Admin (Salesforce Developers) 
hitzhitz

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

 

https://sites.secure.force.com/success/questionDetail?qId=a1X30000000HZogEAG