You can use the
Time Period Library for .NET[
^]:
public void CheckDateBetweenDatesSample()
{
DateTime[] moments = new[]
{
new DateTime( 2011, 11, 02 ),
new DateTime( 2011, 12, 25 ),
new DateTime( 2011, 12, 09 ),
new DateTime( 2011, 12, 13 )
};
TimeRange timeRange = new TimeRange(
new DateTime( 2011, 11, 01 ),
new DateTime( 2011, 12, 15 ) );
Console.WriteLine( "time range: {0}", timeRange );
foreach ( DateTime moment in moments )
{
Console.WriteLine( "{0:d} is inside: {1}",
moment,
timeRange.HasInside(moment) ? "1" : "0" );
}
}