On Wednesday, January 28, 2009 2:14 AM Allen Browne wrote:
Nathan, are you sure you want to go to the trouble of programming this
yourself, when there are proably professional packages available that meet
all the legal requirements in your country?
The basic approach is to use DateDiff() in a query to calculate the number
of minutes. Then divide by 60 to get hours-and-fractions of an hour.
Example, assuming Date/Time fields that contain both the date and time:
Hours: DateDiff("n", [StartDateTime], [EndDateTime]) / 60
This example avoids several traps, e.g.:
- Doesn't use field names that are reserved (such as IN.)
- Copes with shifts that roll past midnight (by storing the date and time in
the same field)
- Doesn't store the calculated duration result in a table field.
(Could be inconsistent with the calculation if you did.)
Things get more complex when you add penalty rates, overtime, non-standard
shifts, public holidays, sick-leave, paid annual leave for part/full timers
(as distinct from casual), tiered pay scales, taxation, commissions,
absenteeism, voluntary salary sacrifice, periodic changes in pay scales,
awards, non-standard work agreements, bonues, danger penalties,
superanuation, and hosts of other issues.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
news:
[email protected]...