Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42482

VS 2010 VB.Net 2010 - DateTime Difference Issue.

$
0
0
HI All,

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
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

Viewing all articles
Browse latest Browse all 42482

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>