Timespan - Allocating Times

lyleza

New member
Joined
Oct 23, 2012
Messages
3
Programming Experience
Beginner
Hi I was hopig that someone can steer me in the right drection,

I am looking for guidance on the following scenarior:

Im trying to do time allocation using Timespan function
Basically
If a person works for aurgment sake between 08:00 and 17:00 -, I would like to allocate differnt hours of the day
Example : for Task 1: (between 09:00 - 12:00), so if the emloyee works 08:00-17:00 then Task on must be allocated 3 hours, the rest of the time may be allocated to some other task
 
What sort of 'guidance' are you after? You know the start and end times of your task, and you know the start and end times of your shift - a bit of simple arithmetic between the task and shift start/end times is all you need.

What have you tried so far?
 
If firstclock <= NormalStart And lastclock <= NormalEnd Then
duration = lastclock.Subtract(NormalStart)
ElseIf firstclock <= NormalStart And lastclock >= NormalEnd Then
duration = NormalEnd.Subtract(NormalStart)
ElseIf firstclock >= NormalStart And lastclock >= NormalEnd Then
duration = NormalEnd.Subtract(firstclock)
ElseIf firstclock >= NormalStart And lastclock <= NormalEnd Then
duration = lastclock.Subtract(firstclock)
End If
 
Ok, let me rephrase that - what have you tried, and what problem are you getting?

The code you posted really doesn't help, since the block you've shown should work, but obviously you've omitted the detail that's causing you the problem (along with the detail OF the problem)
 
No Stress, I figured it out, I read your comment and it made sense,

the snippet of code is from you... (basicall),
 
Back
Top