>I have a start time and end time and subtract start time from end time to get elapsed time. I was wondering how to make the calculation work for multiple days. I have it working for the next day, but not the day after the next day. Would I divide by 86400 to figure out how many days I have to multiple by? I would then multiply by 86400 for that number of days. Thanks for the help.
>
>Here is my code as it currently looks to handle the current day and the next day to show hours and minutes as HH:MM. Of course, I will have to change HH to HHH or add a column for days as in DDD format.
You may try this. It only needs checking whether the hospital.newdate is in the future (haven't tried this with negative number of seconds).
>
>SELECT hospital
>SCAN
>* Calculate elapsed time
> SET DECIMALS TO 0
elapsed = datetime()-hospital.newdate
sec3=int(elapsed%60)
min3=int((elapsed/60)%60)
hrs3=int((elapsed/3600)%24)
days3=int(elapsed/86400)
>ENDSCAN
>