How can I indicate the total time elapsed during the session in question?
I want to make a format like HH:MM (e.g. hours:minutes).
I tried using Timestamp Function.
1. PROC START_TIME
Preproc
$ = timestamp();
2. PROC END_TIME
Preproc
$ = timestamp();
3. PROC DURATIOIN
Prerpoc
$ = END_TIME - START_TIME;
However, it only shows in seconds (e.g. 70 minutes)
In addition, I tried to use TimeString Function. However, I didn't understand (especially the TimeString format) and how to apply it.
Thank you in advance.
Total Elapsed Time
Total Elapsed Time
- Attachments
-
- 1222.png (13.65 KiB) Viewed 725 times
-
- Posts: 1795
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Total Elapsed Time
The timestring function is for formatting dates and or/times. It can't be used for formatting a duration. In your case, you can use some math to get the values you want:
numeric elapsed_seconds = END_TIME - START_TIME;
numeric hours = int(elapsed_seconds / 60 / 60);
numeric minutes = int(elapsed_seconds / 60) % 60;
errmsg("Duration is %02d:%02d", hours, minutes);
numeric hours = int(elapsed_seconds / 60 / 60);
numeric minutes = int(elapsed_seconds / 60) % 60;
errmsg("Duration is %02d:%02d", hours, minutes);