I need to calculate in hours how much time has elapsed from when a record was created to the current time. The hard part is I need to exclude weekend times from this.
I have been working on this for quite a while and I am just lost. Here is what I have so far. Thank you in advance for your help.
Dim MyStartTime As DateTime = "2010-08-09 07:00:00.000"
Dim MyEndTime As DateTime = DateAdd("h", -1, Now())
Dim MyHours As Integer = 0
If Weekday(MyStartTime) > 1 And Weekday(MyStartTime) < 6 Then
MyHours = DateDiff("h", MyStartTime, MyEndTime)
ElseIf Weekday(MyStartTime) = 6 Then
Dim EndTime
date1.Date()
MyHours = DateDiff("h", MyStartTime, MyEndTime)
End If
lblHours1.Text = MyHours
What algorithm in VB.NET would best suit this calculation?