[SalesForce] Calculating duration of time using only Hours, Minutes and Seconds

How can I calculate duration of time between two fields using only HH MM SS? I would need two fields that operator would plug in HH MM SS and have duration calculated into a third field in format that clearly indicates how long the operation took. Any help would be greatly appreciated.

Best Answer

Yes it is possible with a formula field. Create two text fields Text1 and Text2 where times are saved in form 11:30:00 (hour:minutes:seconds). Then create a new formula field of type Number with two decimal places:

((DATETIMEVALUE("2010-01-01 " + Time2__c) - DATETIMEVALUE("2010-01-01 " + Time1__c))*1440)

This formula uses these times and created two datetime values from it. And then just calculated the duration:

enter image description here