If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
DateDiff calculation
I am trying to get an efficiency figure calculation from a start time less a
finish time less the sum of personal breaks and m/c breaks. Start time = Tin Finish Time = TOut start -less finish Time = workedT personal breaks = Pbreak Machine downtime = M/C break I have managed to calculate the WorkedT by using the datediff function, DateDiff("n",[TIn],[TOut])\60 & Format(DateDiff("n",[TIn],[TOut]) Mod 60,"\:00") this is now my workedT, However i now need to subtract the sum of [Pbreak]+[M/C Break] from my [worked time] and my answer needs to be in Minutes. Can anyone help. |
#2
|
|||
|
|||
DateDiff calculation
Try:
DateDiff("n", [Tin], [TOut]) - Nz([Pbreak],0) - Nz([m/c break],0) This assumes yoru field types a - Tin Date/Time - TOut Date/Time - Pbreak Number (in minutes) - m/c break Number (in minutes) If you must Format the result, do so only at the end of the calculation. Format() generates a string (text), which may not handle further calculations the way you expect. -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "snowball" wrote in message ... I am trying to get an efficiency figure calculation from a start time less a finish time less the sum of personal breaks and m/c breaks. Start time = Tin Finish Time = TOut start -less finish Time = workedT personal breaks = Pbreak Machine downtime = M/C break I have managed to calculate the WorkedT by using the datediff function, DateDiff("n",[TIn],[TOut])\60 & Format(DateDiff("n",[TIn],[TOut]) Mod 60,"\:00") this is now my workedT, However i now need to subtract the sum of [Pbreak]+[M/C Break] from my [worked time] and my answer needs to be in Minutes. Can anyone help. |
#3
|
|||
|
|||
DateDiff calculation
Thanks that helped
"Allen Browne" wrote: Try: DateDiff("n", [Tin], [TOut]) - Nz([Pbreak],0) - Nz([m/c break],0) This assumes yoru field types a - Tin Date/Time - TOut Date/Time - Pbreak Number (in minutes) - m/c break Number (in minutes) If you must Format the result, do so only at the end of the calculation. Format() generates a string (text), which may not handle further calculations the way you expect. -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "snowball" wrote in message ... I am trying to get an efficiency figure calculation from a start time less a finish time less the sum of personal breaks and m/c breaks. Start time = Tin Finish Time = TOut start -less finish Time = workedT personal breaks = Pbreak Machine downtime = M/C break I have managed to calculate the WorkedT by using the datediff function, DateDiff("n",[TIn],[TOut])\60 & Format(DateDiff("n",[TIn],[TOut]) Mod 60,"\:00") this is now my workedT, However i now need to subtract the sum of [Pbreak]+[M/C Break] from my [worked time] and my answer needs to be in Minutes. Can anyone help. |
Thread Tools | |
Display Modes | |
|
|