isDateBetween

<Extension()> _
    Public Function isDateBetween(ByVal inBetweenDate As DateTime, ByVal startDate As DateTime, ByVal endDate As DateTime) As Boolean
        Return inBetweenDate >= startDate AndAlso inBetweenDate <= endDate
    End Function
Example:
' Is the date within the allowed range.
Dim startdate  As New DateTime(2000, 01, 01)
Dim enddate  As New DateTime(2020, 01, 01)
If DateTime(2009, 10, 06).isDateBetween(startDate,endDate) Then
' Is in range
Else
' Out of range
End If

Description

Check if a given date is within another specified date range.

Details

Double click on the code to select all.

 

;