在c#4.0中,如何在文本框中查看日期,日期大于等于
DateTime StartDate = Convert.ToDateTime(TxtStrtDate.Text);
DateTime ExpirationDate = Convert.ToDateTime(TxtExpDte.Text);
由于
答案 0 :(得分:8)
怎么样
bool b = ExpirationDate >= StartDate;
阅读此DateTime.GreaterThanOrEqual Operator
OR
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
答案 1 :(得分:2)
DateTime.Compare()
是我能想到的最简单的方式。