在c# 4.0中,如何在文本框中检查日期,日期是否大于或等于
DateTime StartDate = Convert.ToDateTime(TxtStrtDate.Text);
DateTime ExpirationDate = Convert.ToDateTime(TxtExpDte.Text);
谢谢
怎么样
bool b = ExpirationDate >= StartDate;
阅读此DateTime.GreaterThanOrEqual 运算符
或者
int i = DateTime.Compare(ExpirationDate, StartDate);
//if ExpirationDate is less than StartDate then result is Less than zero
//if ExpirationDate equals StartDate then result is Zero
//if ExpirationDate is greater than StartDate then result is Greater than zero
DateTime.Compare()
是我能想到的最简单的方法。