Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exclude time period 1

Status
Not open for further replies.

swetham

Programmer
May 5, 2010
257
DE
I have created an application in which user selects the start_time & end_time of the tasks performed in that day from datetimepicker control (CUstom format HH:mm) and the number of minutes will be calculated automatically. Now my problem is how to remove the lunch break minutes from the minutes calculated? FOr example, if user selects 12:00 to 14:00, number of minutes should be 1.5. (lunch break is from 13:00 to 13:30)
 


Hi, navishu Programmer

You need to use the break start and break finish in your calculation algorythm.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Problem is not only about break start & finish only. If user enters 12:30 to 13:10, 10 minutes should be excluded. Can you please explain the procedure.
 
Here's the basic logic:

If EndTime >= 13:00 And EndTime <= 13:30 Then EndTime = 13:00

If StartTime >= 13:00 And StartTime <= 13:30 Then StartTime = 13:30

If StartTime < 13:00 And EndTime > 13:30 Then
'subtract 30 minutes from total time
End If



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top