Basically I'm trying to have a data display for when start is clicked to document the time then the same for stop. I got that part.
Now I want a field to calculate the difference between. It's not seeming as simply as
{!document.tottime = document.time2 - document.time1}
Any thoughts? Thanks in advance.
Edit: I get a VOID when intialliy clicking the button, but then the time appears when closing the form and reopening.
You can start with val(document.time2) – val(document.time1), that will give you another time with hours and minute after midnight. You can convert that to a string with str() and use sub() to parse it out and calculate minutes. The nice part about doing it this way is the return of val(datetime) - val(datetime) is a standard format "HH:MM xM" or if longer than 24 hours "DD/MM/YYYY HH:MM xM"
Thanks! Got it going in a simple fashion.
{sub(str(val(document.time2) - val(document.time1)),3,2)}
Would this work pretty easily as a function. The end goal will be adding at least 3 sets of these together for another total time.
HI there, I was looking for exactly this functionality and was very happy to find this post. However, when I tried using this, its not quite working the way that I imagined. If I use the code as is,
{sub(str(val(document.time2) - val(document.time1)),3,2)} then the time elapsed will only display after 30 minutes and displays "3". If I change this to {sub(str(val(document.time2) - val(document.time1)),4,3)} Then it displays the correct number of minutes, however if the time goes over 1 hour then the display is no longer correct. Any thoughts on how this could be corrected would be most appreciated.
Off the top of my head I'm not sure, but I will attach what I used to test the calculations out and maybe that could give you some direction. I know this one I implemented into our CCM and they go off of total time by minutes so the calls are relatively short and probably never run over an hour. I will test out what happens with the below form and post what comes up.
EDIT: my form below calculates a total for minutes, so going over an hours results in the number of minutes.
Thank you so much, if I can get to just calculate the number of minutes if it is over 1 hour, that would be great. So far, it comes up with something like "0a" if it goes over an hour, which is not all that helpful. Thanks again for responding.
Did you try it out on the form I attached above and it still didn't calculate right?
Hi was trying to access the form TestTimeStamp but it does not download. Where can I find this?
Theresa Savage
Hi was trying to access the form TestTimeStamp but it does not download. Where can I find this?
Theresa Savage