+ Start a Discussion

Duration Calculation using Text Fields

I've looked throughout the internet looking for a formula to meet my needs with regards to calculating time duration and have failed to find one that meets this very simple need.


Goal: To calculate time difference between two text fields using HH:MM:SS format. (See following)

StartTime: 12:55:23

EndTime:  13:01:15

Duration:     0:05:52


My customer runs tests on equipment and records the start of the test as HH:MM:SS and then the stop time of test in the same format.  I need to set up a calculation field that will take these two inputs and create a result to show the duration in the same format. Excel is excellent at this, but I need this in Salesforce, however, Salesforce seems to want to use Data/Time with the full date...which we don't need.  It also doesn't allow input of SS (keeps erroring out when we try)


Any help on a formula that would allow customer to use the above mentioned format for input and present the result in another text field (in proper format) would be OUTSTANDING!





Jake GmerekJake Gmerek

you will have to do it manually and may not be able to do it in a formula because of formula size limits.  You may be better off creating a VF page, use the controller to calculate the result and then drop that VF page onto your layout.


So essentially you would have to split the string using the colons and subtract each thing and implement cases for carrying.  Not easy I know, but possible.