Coding issue
-
I am currently trying to build some code which handles response times. I have a start time, an end time and a response time. Obviously enough the end time is the start time plus the response time. For example Start time 12:00 Response time 6 hours End time 18:00. My issue is finding out if the two times went over no working hours. Mainly lunchtime 13:00 - 14:00. If I have the start time and end time whats the best way to find out if they ran over a single lunch time or in some cases several lunchtimes? Any suggestions as to how to code this or any tools in .net that would make this easier to do would be appreciated. Thanks
-
I am currently trying to build some code which handles response times. I have a start time, an end time and a response time. Obviously enough the end time is the start time plus the response time. For example Start time 12:00 Response time 6 hours End time 18:00. My issue is finding out if the two times went over no working hours. Mainly lunchtime 13:00 - 14:00. If I have the start time and end time whats the best way to find out if they ran over a single lunch time or in some cases several lunchtimes? Any suggestions as to how to code this or any tools in .net that would make this easier to do would be appreciated. Thanks
i think u should check to see if the timespan between the start time and the no work start time in question is positive, as in the start time is definitely before the no work start time. then if it is positive, check to see if the time span between the end time and the no work start time is also positive, depending on wat u subtracted from the other, then take it from there. if u dont understand this please say so and i can give u more structured pseudo code.
-
i think u should check to see if the timespan between the start time and the no work start time in question is positive, as in the start time is definitely before the no work start time. then if it is positive, check to see if the time span between the end time and the no work start time is also positive, depending on wat u subtracted from the other, then take it from there. if u dont understand this please say so and i can give u more structured pseudo code.
I think what you have mentioned here is pretty much what I have described but consider the following. If the start time was 09:00. And the response time was 8 hours, the time to respond by would be 17:00. The thing is this calculation would have gone over lunch time. At which point I need to add 1 additional hour as lunch time is not counted. DO you understand my problem here?
-
I think what you have mentioned here is pretty much what I have described but consider the following. If the start time was 09:00. And the response time was 8 hours, the time to respond by would be 17:00. The thing is this calculation would have gone over lunch time. At which point I need to add 1 additional hour as lunch time is not counted. DO you understand my problem here?
Hi Sam, My confusion is wat the input is and wat the output should be. Could you please clarify wat you are inputting into the system (whether its start or end time, duration or lunch start and end time), also clarify wat the output u want is and we can take it from there. Sheers
-
Hi Sam, My confusion is wat the input is and wat the output should be. Could you please clarify wat you are inputting into the system (whether its start or end time, duration or lunch start and end time), also clarify wat the output u want is and we can take it from there. Sheers
I have a start time, created when the job is logged. I have a response time, taken from the contract that covers the job. Therefore I have a 'time to respond to by'. Which is the logged time plus the given time span. Therefore this final time is what my calculations are aiming towards. My issue is how do I check if my two times have gone over a lunch time or not??
-
I have a start time, created when the job is logged. I have a response time, taken from the contract that covers the job. Therefore I have a 'time to respond to by'. Which is the logged time plus the given time span. Therefore this final time is what my calculations are aiming towards. My issue is how do I check if my two times have gone over a lunch time or not??
public function getTimeWorked(ByVal StartTime as date, ByVal Duration as TimeSpan, _
ByVal EndTime as date, ByVal LunchStartTime as date, ByVal LunchDuration as TimeSpan) as TimeSpandim ActualTimeWorked as TimeSpan
dim TimeWorked as TimeDuration = StartTime - EndTime
if (StartTime < LunchStartTime) and (EndTime > (LunchStartTime + LunchDuration)) then
ActualTimeWorked = TimeWorked - LunchDuration
endif
return ActualTimeWorked
end ifWithin the same if statement, u can modify the code to get if the guy finished work DURING lunch period and do the necessary calculations or if he started DURING the lunch period and calculate accordingly.