C#中比较两个日期大小的方法
////// 比较两个日期大小//////日期1///日期2///返回信息publicvoid CompanyDate(string dateStr1,string dateStr2,refstring msg) {//将日期字符串转换为日期对象 DateTime t1 = Convert.ToDateTime(dateStr1); DateTime t2= Convert.ToDateTime(dateStr2);//通过DateTIme.Compare()进行比较()int compNum = DateTime.Compare(t1, t2);//t1> t2if (compNum >0) { msg="t1:(" + dateStr1 +")大于" +"t2(" + dateStr2 +")"; }//t1= t2if (compNum ==0) { msg="t1:(" + dateStr1 +")等于" +"t2(" + dateStr2 +")"; }//t1