Date/Time Calculation

  • Thread starter Thread starter gaber85 via AccessMonster.com
  • Start date 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
 
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
 
Back
Top