Hours Calculations

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I made a small database and needed to calculate the time (hours: minutes) of
a task. My problem is that the end time is after the 12:00 p.m. and if it is
less than the original?

Eg:

Start: 21:00
End: 2:30

The result should be 5:30, but not because considers the time of the lower
end of the beginning.

Someone can help me? Recall that I am a newcomer ...

Regards,
 
You need to keep track of the specific start time (Date & Time) in a
date field, and the same for the end time. You can then use the
DateDiff function.

For example if you want an integer number of hours:
Hours: DateDiff("h",[Start_Time],[End_Time])

For example if you want a decimal number of hours:
Hours: DateDiff("n",[Start_Time],[End_Time])/60
 
First of all thanks for the reply.
But I have the field "data" as the sole, so, the service starts in that
date but may finished from 12 a.m. and i wanted to avoid putting the date of
termination of service to calculate the exact value between the hours. For
eg.: putting
25:00 like EXCEL to be 1:00am from next day?


There's anyway to do that?


"Kerry" escreveu:
You need to keep track of the specific start time (Date & Time) in a
date field, and the same for the end time. You can then use the
DateDiff function.

For example if you want an integer number of hours:
Hours: DateDiff("h",[Start_Time],[End_Time])

For example if you want a decimal number of hours:
Hours: DateDiff("n",[Start_Time],[End_Time])/60


Hello,

I made a small database and needed to calculate the time (hours: minutes) of
a task. My problem is that the end time is after the 12:00 p.m. and if it is
less than the original?

Eg:

Start: 21:00
End: 2:30

The result should be 5:30, but not because considers the time of the lower
end of the beginning.

Someone can help me? Recall that I am a newcomer ...

Regards,
 
The word "data" must be read "date"

"VG" escreveu:
First of all thanks for the reply.
But I have the field "data" as the sole, so, the service starts in that
date but may finished from 12 a.m. and i wanted to avoid putting the date of
termination of service to calculate the exact value between the hours. For
eg.: putting
25:00 like EXCEL to be 1:00am from next day?


There's anyway to do that?


"Kerry" escreveu:
You need to keep track of the specific start time (Date & Time) in a
date field, and the same for the end time. You can then use the
DateDiff function.

For example if you want an integer number of hours:
Hours: DateDiff("h",[Start_Time],[End_Time])

For example if you want a decimal number of hours:
Hours: DateDiff("n",[Start_Time],[End_Time])/60


Hello,

I made a small database and needed to calculate the time (hours: minutes) of
a task. My problem is that the end time is after the 12:00 p.m. and if it is
less than the original?

Eg:

Start: 21:00
End: 2:30

The result should be 5:30, but not because considers the time of the lower
end of the beginning.

Someone can help me? Recall that I am a newcomer ...

Regards,
 
Hello,

I made a small database and needed to calculate the time (hours: minutes) of
a task. My problem is that the end time is after the 12:00 p.m. and if it is
less than the original?

Eg:

Start: 21:00
End: 2:30

The result should be 5:30, but not because considers the time of the lower
end of the beginning.

Someone can help me? Recall that I am a newcomer ...

Regards,

If the time will never (EVER!) exceed 24 hours, you can use

DateDiff("n", [Start], [End]) + IIF([Start] > [End], 1440, 0)

to calculate the minutes elapsed; or - risky because Date/Time values are
designed for storing points in time and not durations -

DateValue([End] - [Start] + IIF([Start] > [End], 1.0, 0))


John W. Vinson [MVP]
 

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

Back
Top