Date/Time Calculation

  • Thread starter gaber85 via AccessMonster.com
  • Start date
G

gaber85 via AccessMonster.com

Hello, I have a form that I need to calculate duration. I'm sure it is
somewhat simple to do but I'm just not sure how to do it. I have to fields,
one is start time and the other is end time and both have the medium time
input mask on them. All I want to do is calculate the duration in the
duration field based on what is entered in the start and end time fields.
How do I do this? Any help is appreciated. Thanks
 
R

Ron2006

timespend = datediff("h",me.StartTime,me.EndTime)

with the "h" part possibly being
h Hour
n Minute
s Second

The answer should then be divided by 60 or whatever to compute days,
hours, minutes or whatever, and displayed and saved as a number NOT a
date formated value.


Now for considerations,
What if the start and end are on different days?
What if the start and end are across the weekend?
What if the start and end are across a holiday with or without a
weekend also?

Start time and end time should probably be a full date and time value
especially if they can be on different days.
Should also probably check that end time is gtr than start time
(complete day and time comparison).

Computing spent time is no easy task if there are no constraints such
as always in same day or something like that.

Good Luck

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

Similar Threads

calculating time help 0
HELP !!!! Calculate TIME 0
Date Calculation 4
Calculation 1
Converting seconds to hh:mm:ss 2
elapsed time 4
Disconnect users at 5pm every day [DateDiff question] 6
Calculating Time 2

Top