Formula to calculate difference between two dates in Salesforce

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.

TEXT(
FLOOR(End_Date__c - Start_Date__c)
) & " Day(s) " &
TEXT(
ROUND(MOD((End_Date__c - Start_Date__c)*24,24),0)
) &" Hour(s) " &
TEXT(
ROUND(MOD((End_Date__c - Start_Date__c)*1440,60),0)
) &" Minute(s) "
“Formula

References & Useful URLs

7 thoughts on “Formula to calculate difference between two dates in Salesforce”

  1. 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.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top

Don't Miss Out on New Step-by-Step How To Guides on Salesforce...

…Subscribe to Our Newsletter!