Extracting a range of times from a start and end time

me1258

Newcomer
Joined
Jun 30, 2004
Messages
2
I am trying to write a program that will take a start time and an end time and then tell me how many minutes
of that time span fall with in a predetermined time frame.

Example

I log in at 13:00 I log out at 00:00

I want to know how much time (in minutes) elapsed in the range of 15:00 to 23:00 during that log in period

The answer here would be 8 hrs or x minutes.

Thanks
 
You could store the time when they login in one variable and then on exit calculate the difference i.e.
Visual Basic:
Dim d1 As DateTime = DateTime.Now
'do something in between
Dim d2 As DateTime = DateTime.Now

Dim ts As TimeSpan = d2.Subtract(d1)
MessageBox.Show(ts.Hours.ToString & ":" & ts.Minutes.ToString)
'or
MessageBox.Show(ts.TotalMinutes.ToString)
 
My bad, he would just need to create a couple of date objects set to pre-determined timse and use those for comparison / subtraction.
Visual Basic:
Dim d2 As DateTime = new DateTime(datetime.Today.Year,datetime.Today.Month, datetime.Today.Day, 15,0,0)
 
hi! i would like to know how to calculate a range of time in crystal report. When timein is 9:00am and out at 12:00pm. If the normal time of shift starts at 8:00am, how will i calculate undertime?
Any help would be greatly appreciated.
 
Back
Top