Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • Administrators
Posted

You could store the time when they login in one variable and then on exit calculate the difference i.e.

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)

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

  • 1 year later...
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...