Start & End Time Question

jk12

Always getting problems.
Local time
Today, 21:55
Joined
Feb 16, 2006
Messages
91
Hi all. I would like to know if anybody knows, if it's possible to add the number of hours worked, say 9.5, to a start time, say 07:30, to generate a finish time, in this example 17:00.

This seems a strange question as the response I'll probably get will be, why not have hours worked calculated from the difference between the start and finish time.

the reason for this is people using the database assign hours worked to different tasks which are then totaled for the day i.e Task 1 4hours Task 2 5.5 hours, total for day 9.5 hours. I currently DO work out the correct number of expected hours via the difference between the start and finish time which is highlighted to the user next to the total hours they have entered to ensure the 2 match up, however some users ignor this put in the corrct number of hours worked then don't amend the start and finish times.
This makes my report look extremely messy as hours worked and times worked don't match which means I'm geting moaned at by people using the report as they have to do more work by looking into which is correct, the hours or times.

Its for his reason I wanted to try and get an answer to my original question, is it possible to add hours worked to a start time to get a finish time. Even if the start time is wrong, at least this way the difference between the start and finish time would match the number of hours worked.

For reference, hours worked fields are number (single format) fields, start time field is currently a Date/Time field

Hope this is clear enough and I haven't rambeled to much.:D
 
At least three issues, here.

1. The difference between hours attended and hours worked is known as efficiency in management terms. Few workers are able to record 100% of their time against jobs. So is your time difference an error or an efficiency indicator?
2. Access doesn't have a Time datatype, just a Date/Time. Even if you think you are storing time, there's an implicit date, too. This can make the maths really complex. Add to that, Date/Time is stored as a decimal number with the integer part indicating the date and the fractional part the time, and the whole thing can get out of hand. If you want to use this datatype, you need to look at the DateAdd() function.
3. It can make like simpler to abandon the Date/Time field and use plain numbers. I have stored time intervals in numbers of seconds, minute or hours depending on the application. You need to convert these for display purposes to something that looks like a time, but it makes the maths so much easier.
 
Sure; you can add them with the DateAdd function.
 
cheers for the replies, I will try out both methods suggested (abandon date/time datatype and use the DateAdd function)
 
Simple Software Solutions

One thing you seemed to indicate in your post bud did not clearly define it, was the format in which the user would enter the duration. There are two possible options, either as a time in hh:nn or as a number h.n in other words

2.5
or
02:30

You will need to decide on which format to use and stick to it. And as suggested store the times as minutes past midnight.

CodeMaster
 

Users who are viewing this thread

Back
Top Bottom