-1

in c# 4.0、テキストボックスで日付を確認する方法、日付がより大きいか等しい

DateTime StartDate =  Convert.ToDateTime(TxtStrtDate.Text);
DateTime ExpirationDate = Convert.ToDateTime(TxtExpDte.Text);

ありがとう

4

2 に答える 2

8

どうですか

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
于 2012-06-09T12:58:07.587 に答える
2

DateTime.Compare() is the easiest way I can think of.

于 2012-06-09T13:07:19.353 に答える