Here is the formula to calculate the difference between two dates in Salesforce. The difference is returned in Days, Hours & Minutes. Works like a charm.
FLOOR(End_Date__c - Start_Date__c)
) & " Day(s) " &
ROUND(MOD((End_Date__c - Start_Date__c)*24,24),0)
) &" Hour(s) " &
ROUND(MOD((End_Date__c - Start_Date__c)*1440,60),0)
) &" Minute(s) "
7 thoughts on “Formula to calculate difference between two dates in Salesforce”
Have you got the solution for this, if yes can you share it with me? Thanks
Hi Shahbaz, I am not sure if I have understood your question. What solution are you looking for?
how can we calculate time in reports. is it possible to bucket field on time
If I have two fields such as
1. Time taken for drafting : 12Day(s) 1 Hour(s) 20 Minute(s)
2. Time taken for negotiation: 30 Day(s) 0 Hour(s) 2 Minute(s)
How can we get the total of the above 2 fields.
good post dear
but how we can calculate date difference in if condition
but in that we can not calculate weekends so plz reply me?