HI All,
Please help me on resolving the below issue.
I have Function to get the datetime difference as given below:
Function BusinessDatetimeDiff(ByVal StartDate As DateTime, ByVal EndDate As DateTime) As Long
Dim BizDateDiff As Long
Try
BizDateDiff = DateDiff("d", StartDate, EndDate) - DateDiff("ww", StartDate, EndDate, FirstDayOfWeek.Saturday) - DateDiff("ww", StartDate, EndDate, FirstDayOfWeek.Sunday) + 1
Catch ex As Exception
' Do nothing
End Try
Return BizDateDiff
End Function
StartDate = "1/18/2013 5:05:44 PM"
EndDate = "1/21/2013 6:30:00 PM"
Correct Result = 2
But the result = 3
Can Anyone tell me what went wrong ???
Thanks
Please help me on resolving the below issue.
I have Function to get the datetime difference as given below:
Quote:
Function BusinessDatetimeDiff(ByVal StartDate As DateTime, ByVal EndDate As DateTime) As Long
Dim BizDateDiff As Long
Try
BizDateDiff = DateDiff("d", StartDate, EndDate) - DateDiff("ww", StartDate, EndDate, FirstDayOfWeek.Saturday) - DateDiff("ww", StartDate, EndDate, FirstDayOfWeek.Sunday) + 1
Catch ex As Exception
' Do nothing
End Try
Return BizDateDiff
End Function
EndDate = "1/21/2013 6:30:00 PM"
Correct Result = 2
But the result = 3
Can Anyone tell me what went wrong ???
Thanks