如何检查两个日期之间的日期?

时间:2014-11-12 09:34:39

标签: sql

如何检查日期 11/10/2011 '11 / 15/2014'

2 个答案:

答案 0 :(得分:1)

以下显示使用DateTime的示例:

var startDate = new DateTime(2014,11,10);
var endDate = new DateTime(2014,11,15);

var dateToCheck = new DateTime(2014,11,12);

if(startDate < dateToCheck && endDate > dateToCheck)
{
    // Do something
}

答案 1 :(得分:0)

if (dateToBeChecked > lowDate && dateToBeChecked < highDate)
{
    // do this where the date is between the dates specified
}
else
{
    // do something else
}