Ask Search:
Richard RobinsonRichard Robinson 

Create a formula field that calculate the difference between 2 date/time fields?

I need to create a field that calculates two Date/Time fields that returns the total number of mins between the two.. Is this possible.
Rajith MedaganiRajith Medagani

yes you can, the difference between 2 date time field can be directly calculated by subtracting to those fields. The returned data type is Number and that will be number of days between those days. So if you multiply that by 1440 you will get the number of minutes between those. I have tested this and it works. You might have to tweak in a little got get it work exactly but the following will work.

((test_1__c - test__c)*1440).

This will default to 2 decimal points and you can remove that if you want but keep in mind that this will be a number field and not min as Salesforce does not support min as data type.

Richard RobinsonRichard Robinson

Thanks alot for your suggestion.. I will defintely keep this in mind but did some more research and found the following whcih was exactly what I was looking for..

Jarrett KuljisJarrett Kuljis
The hint given about ( * 1440) was exactly what my tired brain was missing.  It makes total sense,24 hours in a day, ...  Anyways I just wanted to say thanks posting! 
Justin BarssJustin Barss
Thanks to all the answers below!
Fuller TalbotFuller Talbot
After finding the duration of time with SUB and  * 1140-- is there anyway to convert this into minutes?
Fuller TalbotFuller Talbot
Actually this is a formula I used it it seems to be working:

(floor((TimeOut__c -  TimeIn__c)*24))
(((((TimeOut__c -  TimeIn__c)*24)-floor((TimeOut__c -  TimeIn__c)*24))*60)/100)
Peter AndresenPeter Andresen

Created an version that shows Days and Hours:

'D: '+TEXT(floor(End_Date_and_Time__c - Start_Date_and_Time__c)) 

' '
'H: ' +TEXT(((End_Date_and_Time__c - Start_Date_and_Time__c)-floor((End_Date_and_Time__c - Start_Date_and_Time__c)))*24)