Converting Hours in decimal format to Hours and minutes (short time)

G

Gina

I want to find the elappsed time betwin StartTime and EndTime which
are in a table. I can get the answer in a Form using the startTime
and endTime with ' =([EndTime*1]-[StartTime]*24)', but the answer to
that function naturally is in decimal hours. e.g. StartTime is 08:00,
EndTime is 17:23 and the form result returns 9.5333333. That's great,
the function works, but now I want to get it back in ti 'short time'
fornat so that the answer to the example would read 9:23.
 
R

rquintal

I want to find the elappsed time betwin StartTime and EndTime which
are in a table. I can get the answer in a Form using the startTime
and endTime with ' =([EndTime*1]-[StartTime]*24)', but the answer to
that function naturally is in decimal hours. e.g. StartTime is 08:00,
EndTime is 17:23 and the form result returns 9.5333333. That's great,
the function works, but now I want to get it back in ti 'short time'
fornat so that the answer to the example would read 9:23.

If the data is stored in date/time type fields, usae the datediff()
function to return the difference in minutes. Once you have that, you
use a user defined function to extract the number of hours, and the
number of minutes, then format each as two digit numbers.

=Format(datediff("n",startTime,EndTime)\60,"00") & ":" &
Format(datediff("n",startTime,EndTime) mod 60,"00")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top