Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
The time is being recorded as 1200-2000 in a text field called "Time" and them I'm converting the data with this code:
dim a, t1 as date, t2 as date
a = split([Time],"-")
t1 = TimeSerial(mid(a(0),1,2),mid(a(0),3,2),0)
t2 = TimeSerial(mid(a(1),1,2),mid(a(1),3,2),0)
msgbox "diff is " * abs(t2-t1)*24
msgbox "diff is " & abs(t2-t1)*24
Me.Hours = HrsDuration([TIME])
in the first posting. Clearly anyone attempting to provide any assistance would have made the same assumption as Skip that there were two date/time values.lars7 said:The time is being recorded as 1200-2000 in a text field called "Time"
It does not.Left([time],InStr([time],"-")-1) --> converts to 12:00 in "Text2"
Mid([time],InStr([time],"-")+1) --> converts to 20;00 in "Text3"
function HrsDuration(s as string) as single
's contains the representations of 2 time values
' "hhmm-hhmm"
'parse 2 values, convert to TIME, return difference
dim a, t1 as date, t2 as date
a = split(s,"-")
t1 = TimeSerial(mid(a(0),1,2),mid(a(0),3,2),0)
t2 = TimeSerial(mid(a(1),1,2),mid(a(1),3,2),0)
HrsDuration = abs(t2-t1)*24
end function