我想檢查選定的月份是否已經過去。C#比較月份
if (Convert.ToDateTime(DDMonths.SelectedItem.Text).Month > DateTime.Now.Month)
{
//logic here if date is not in the past
}
DDMonths.SelectedItem.Text
值April
不過我正在以下格式異常錯誤:
String was not recognized as a valid DateTime.
完美謝謝 – user1986761