RIAS
asked on
Calculate number of nights between two dates
Hello,
I am using vb.net 2015 .
Is there a way to calculate number of nights between two dates .
Cheers
I am using vb.net 2015 .
Is there a way to calculate number of nights between two dates .
Cheers
ps. If by date you actually mean date with time then you would need to use just the date part of the datetime (eg dteX.Date rather than dteX).
ASKER
Andy,
I am passing arguments to the function as string so need to convert to date?
I am passing arguments to the function as string so need to convert to date?
Private Function CalculateNumberofNightsStay(ByVal dteLater As String, ByVal dteEarlier As String)
Dim ts As TimeSpan = dteLater - dteEarlier
NumberOfNights = ts.Days
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Andy!!!
NumberOfNights = ts.Days