条件是否有日期. [英] If conditions with dates.

查看:59
本文介绍了条件是否有日期.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果条件允许,我们可以使用..

我可以用日期实现休闲功能吗?.





CAN WE USE IF CONDITION WITH DATES..

can i implement the fallowing functionality with dates..





if (TextBox1.Text<01/01/2001)

{
lblres.Text="value should be more than 01/01/2001";
}



我知道语法是错误的.什么是正确的语法.



i know the syntax is wrong.. what would be the correct syntax..

推荐答案

看看
Have a look at DateTime.Parse Method[^]. You can use that for your input.


使用 DateTime.TryParse [ ^ ]以避免不必要的操作例外.
Use DateTime.TryParse[^] to avoid unnecessary exception.


这比拔牙还差!
花大量时间一些了解 DateTime [ ^ ]结构,以及用它.除了简单的字符串相等性之外,您不能在存储为字符串的日期上使用比较运算符,即使那样您也会得到错误的答案.
This is worse than pulling teeth!
Spend some a lot of time learning about the DateTime[^] structure, and use it. You cannot use comparison operators on dates stored as strings, apart from simple string equality, and even then you can get the wrong answer.


这篇关于条件是否有日期.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆