检查dateTimePicker值是否在今天之前 [英] Check if dateTimePicker value is before today
问题描述
我正在尝试创建一个if语句,该语句将确定dateTimePicker值是否在今天之前,并且不确定如何执行.
I im trying to create an if statement that will determine if dateTimePicker value is before today and im not sure how to do it.
它可能看起来像这样:
if(dateTimePicker< dateTime.Now)
if(dateTimePicker < dateTime.Now)
{
///
}
是这样做的正确方法吗?
Is that the correct approach of doing that?
推荐答案
弗兰莫格,
谢谢您在这里发布.
用于从DataTimePicker控件获取数据.您需要使用dateTimePicker1.Value.Date.
For getting the Data from DataTimePicker control. You need to use the dateTimePicker1.Value.Date.
我希望 MSDN文档将对您有所帮助.
I hope the MSDN document would be helpful for you.
如果您的问题已解决,请记住通过将有用的帖子标记为答案来结束您的话题,这可能会对其他有相同问题的人有所帮助.
If your issue has been resolved, please remember to close your thread by marking useful posts as answer that can be helpful for other person with same issue.
最好的问候,
Hart
这篇关于检查dateTimePicker值是否在今天之前的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!