Bruce, This might be a start for elapsed time calcs. It's from my notes
of January 2016, with credit to Emmitt Dove:
Finding total hours between 2 times
Assuming you have datetime values:
SET VAR vhours INTEGER = (INT((.vstoptime - .vstarttime) / 3600))
When you subtract two datetime values the result is the difference in
seconds.
Emmitt Dove, 5/24/2007
###
--Elapsed Hr:Mn for integer # of minutes
R>SET VAR vMinutes INTEGER = 80
R>SET VAR vElapsed TEXT = (CTXT(INT(.vMinutes/60)) +':'+
CTXT(MOD(.vMinutes,60)))
R>show var vElapsed
1:20
Doug
On 7/14/2020 6:41 PM, Bruce Chitiea wrote:
I've been hunting for a simple function to convert a TIME value
(/e.g./ 10:15) to a REAL value (/e.g./ 10.25), to make "elapsed time
math" easy.
Something like: *(DTIME(.vTimeValue))* ... which I'm not seeing.
This would reduce elapsed-TIME calculations to:
SET VAR vTime_End_DOUBLE = (DTIME(.vTime_End_TIME))
SET VAR vTime_Beg_DOUBLE = (DTIME(.vTime_Beg_TIME))
SET VAR vTime_Elapsed_DOUBLE = (.vTime_End_DOUBLE - .vTime_Beg_DOUBLE)
I'm absolutely sure I'm just missing something insanely simple.
Meanwhile, something like Footnote [1] does the job, but forget about
putting it in a Calculated Column Definition, which is the best place
for such a basic calculation.
??
Thanks, Bruce
Bruce A. Chitiea
SafeSectors, Inc.
-----------------------------------
112 Harvard Ave #272
Claremont CA 91711-4716
-----------------------------------
/rby...@safesectors.com/
/-----------------------------------/
+011 (909) 238-9012 c
+011 (909) 912-8678 f
[1] Not elegant, but it works:
SET VAR vTime_Beg TIME = NULL
SET VAR vTime_End TIME = NULL
SET VAR vTime_Elapsed DOUBLE = NULL
SET VAR vTime_Beg_IHR INT = NULL
SET VAR vTime_Beg_IMIN INT = NULL
SET VAR vTime_Beg_DMIN DOUBLE = NULL
SET VAR vTime_End_IHR INT = NULL
SET VAR vTime_End_IMIN INT = NULL
SET VAR vTime_End_DMIN DOUBLE = NULL
SET VAR vTime_End = 13:30
SET VAR vTime_Beg = 10:15
SET VAR vTime_Beg_IHR = (IHR(.vTime_Beg))
SET VAR vTime_Beg_IMIN = (IMIN(.vTime_Beg))
SET VAR vTime_Beg_DMIN = (.vTime_Beg_IMIN/60)
SET VAR vTime_End_IHR = (IHR(.vTime_End))
SET VAR vTime_End_IMIN = (IMIN(.vTime_End))
SET VAR vTime_End_DMIN = (.vTime_End_IMIN/60)
SET VAR vTime_Beg_DEC = (.vTime_Beg_IHR + .vTime_Beg_DMIN)
SET VAR vTime_End_DEC = (.vTime_End_IHR + .vTime_End_DMIN)
SET VAR vTime_Elapsed = (.vTime_End_DEC - .vTime_Beg_DEC)
WRITE .vTime_Beg_IHR
WRITE .vTime_Beg_IMIN
WRITE .vTime_Beg_DMIN
WRITE .vTime_Beg_DEC
WRITE ' '
WRITE .vTime_End_IHR
WRITE .vTime_End_IMIN
WRITE .vTime_End_DMIN
WRITE .vTime_End_DEC
WRITE ' '
WRITE .vTime_Elapsed
RETURN
--
For group guidelines, visit
http://www.rbase.com/support/usersgroup_guidelines.php
---
You received this message because you are subscribed to the Google
Groups "RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to rbase-l+unsubscr...@googlegroups.com
<mailto:rbase-l+unsubscr...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/rbase-l/emd7e644de-7035-4588-b4ef-1d6053f7916b%40pathfinder
<https://groups.google.com/d/msgid/rbase-l/emd7e644de-7035-4588-b4ef-1d6053f7916b%40pathfinder?utm_medium=email&utm_source=footer>.
--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
--
For group guidelines, visit
http://www.rbase.com/support/usersgroup_guidelines.php
---
You received this message because you are subscribed to the Google Groups "RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to rbase-l+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/rbase-l/ae5fc457-1cc7-a2fd-e8ad-0b70b704152b%40wi.rr.com.