L
Lichase
Hi,
I am using this module to calculate elpased time(TimeConv).
How can I also account for Holidays and Working hours(8 am - 8 pm).
Any help would great.
Function TimeConv(dteStart, dteEnd As Date) As Double
Dim X As Integer, Y As Integer, I As Integer
X = 0
Y = 1
I = 0
X = Int(dteEnd - dteStart + 0.5)
If X > 0 Then
Do Until Y = X + 1
If WeekDay(dteStart + Y) = 1 Or WeekDay(dteStart + Y) = 7 Then
I = I + 1
End If
Y = Y + 1
Loop
TimeConv = ((Abs(dteStart - dteEnd) * 86400) - (I * 86400)) / 3600
Else
TimeConv = Abs(dteStart - dteEnd) * 86400 / 3600
End If
If TimeConv < 0 Then
TimeConv = 1
End If
End Function
I am using this module to calculate elpased time(TimeConv).
How can I also account for Holidays and Working hours(8 am - 8 pm).
Any help would great.
Function TimeConv(dteStart, dteEnd As Date) As Double
Dim X As Integer, Y As Integer, I As Integer
X = 0
Y = 1
I = 0
X = Int(dteEnd - dteStart + 0.5)
If X > 0 Then
Do Until Y = X + 1
If WeekDay(dteStart + Y) = 1 Or WeekDay(dteStart + Y) = 7 Then
I = I + 1
End If
Y = Y + 1
Loop
TimeConv = ((Abs(dteStart - dteEnd) * 86400) - (I * 86400)) / 3600
Else
TimeConv = Abs(dteStart - dteEnd) * 86400 / 3600
End If
If TimeConv < 0 Then
TimeConv = 1
End If
End Function