Formula Field Elapsed Time

Posted by ddubois on 01-Jul-2015 11:42

I have created a formula field called TotalTime.  I use this code to determine the elapsed time between two dates. 

The elapsed time displays correctly in the debug window.  How do I return the elapsed time using this code to the formula field Total Time?

All Replies

Posted by pvorobie on 01-Jul-2015 13:13

What is "formula field Total Time" ? Please clarify.

Posted by ddubois on 01-Jul-2015 13:21

TotalTime is a formula field that calculates the elapsed time between a student check in and a student check out.  It needs to return the total time in hours and minutes between that students checkout and check in time. 

Posted by Bill Wood on 01-Jul-2015 14:08

The Formula computation needs to actually return the string that you want to display.  That is, what i think you want to do is add a final line that returns the string you want to display.

return dhm(data3);

Posted by pvorobie on 01-Jul-2015 14:14

You have a field of type "String" and your formula returns a string in format "00:00".

Posted by ddubois on 01-Jul-2015 14:32

I keep getting an invalid return error:


Posted by ddubois on 01-Jul-2015 15:08

Corrected spelling of date on line 6

Posted by ddubois on 01-Jul-2015 15:20

 Found the answer to my problem in the documentation:  :

Posted by ddubois on 01-Jul-2015 15:22

 Reivised code that works correctly.

This thread is closed