Does anyone have code to calculate the difference in time using the TIMESTAMP data symbol? I have a form with start and stop time fields that are populated with the TIMESTAMP data symbol via set values buttons, and I would like to add another button to calculate the difference in minutes between the start and stop time.
Any help is appreciated.
Thank you.
Try this:
{fn Start_Test()
{
local strInitTime=""
strInitTime=Conv_Val(getprocessclock())
obsnow("Oswestry 1","on")
obsnow("Oswestry 2","on")
obsnow("Oswestry 3","on")
obsnow("Oswestry 4","on")
obsnow("Oswestry 5","on")
document.time_msec=str(val(Conv_Val(getprocessclock()))-val(strInitTime))
}
}
{fn Conv_Val(strClk)
{
local strVal=sub(strClk,1,7)
strVal=replacestr(strVal,".","")
return strVal
}
}
I am looking for something along these lines as well. The function posted above will work as long as the person remains logged in. Once that person logs out it resets the getprocessclock() function. I need to use the timestamp symbol as well due to the fact that the person might logout from one pc to another between charting and patient rooms thus resetting the getprocessclock. As a stopwatch though the getprocessclock would work great.
I went ahead and made a function for this. DLG attached: Time-Duration v2
I am trying to create a form in VFE that would calculate the total time (document.start1 - document.stop1) + (document.start2 - document.stop2) and diplay this in totaltime. Would your time-duration calculation work? (these are time stamps)
The calculation will give you the total time (in minutes I believe) between the two time stamps. You may have to format that time from there to display hours/min/sec if that is what your are needing.