time in 24 HRS problem

J

Jon

Greeting;

I have a form for shift works calculating time. The first Shift is start at
7:00 and end at 15:30. The second one is start at 15:00 and end at 23:30 .
and the last shift is start at 23:00 and end at 7:30. These times are
presented at two text boxes, Start time and End time. Moreover, there are two
text boxes for the actual time of starting and end time and they are
presented at Enter time Exit time. Now there are two text boxes for
calculating the Daley time and extra time as follows: Extra time = Exit
time-End time and the Daley time =Enter time-start time. All those times are
calculated well for the first shift works. The problem now with the second
and the last shift works. If the employee exits the job at 1:15 pm the result
should be at the extra time 45 minuets but now the result is 23:15. how to
solve this problem?
 
R

Ron2006

1) The answer for the calculations cannot be a datetime type of field.
That is designed to display a point of time not duration.

2) To compute the elapsed time you have to include the date part of
the start and end time in the calculation.

3) Use the datediff function to compute the total difference in
minutes and then compute the hours by deviding by 60 and I think then
a mod can give you the difference

here is a reference that explains it all:

Calculating elapsed time at:
http://allenbrowne.com/casu-13.html

The article explains how to use DateDiff() to get the difference in
minutes,
and then display the value as hours and minutes.


--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Ron
 
J

Jon

Thank you Ron, but if the time is over 23:59 or 0:15 a.m e.g the result of
subtracting 23:30-0:15 is -23-:15
How to sovle this problem please???:(
 
A

Albert D. Kallal

Jon said:
Thank you Ron, but if the time is over 23:59 or 0:15 a.m e.g the result of
subtracting 23:30-0:15 is -23-:15
How to sovle this problem please???:(

If you as the other posters suggests include the date portion, then you can
add/subtract hours over 24 hour periods..and you get the correct results.

So, what is being suggested here is to actually *include* the date portion
into the time fields.

In a sense, is that 2am today, or is it tomorrow? It is in fact 2 am
tomorrow, and thus it should be entered as tomorrow date + time...
 
R

Ron2006

Go to Allen's site and look at his example, Having seen other work by
him, I am sure he has an example demonstrating how and why to use the
full date/time expression NOT just time.

Ron
 

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