怎样比较dateTimePicker中日期的大小

时间:2021-01-06 18:09:45
怎样比较dateTimePicker中日期的大小,用来判断dateTimePicker1中的日期小于或大于dateTimePicker2中的日期,怎样比较呢?在线给分

5 个解决方案

#1


if(this.dateTimePicker1.Value >this.dateTimePicker2.Value)
{
}

#2


if (dateTimePicker1.Value > dateTimePicker2.Value)

#3


if(DateTime.Compare(this.dateTimePicker1.Value,this.dateTimePicker2.Value)>0)
{
    //dateTimePicker1中的日期大于dateTimePicker2中的日期
}

#4


返回值<0,则小于

#5


谢啦

#1


if(this.dateTimePicker1.Value >this.dateTimePicker2.Value)
{
}

#2


if (dateTimePicker1.Value > dateTimePicker2.Value)

#3


if(DateTime.Compare(this.dateTimePicker1.Value,this.dateTimePicker2.Value)>0)
{
    //dateTimePicker1中的日期大于dateTimePicker2中的日期
}

#4


返回值<0,则小于

#5


谢啦