时间日期的比较
在C#语言中,不知道大家是怎样来比较两个时间的大小的。 
 比如,现在是2007-07-16   10:35:00, 
 我给定一个时间   2007-08-17   12:00:00 
 怎样比较这两个时间日期的大小?
------解决方案--------------------DateTime t1 = new DateTime(100); 
 DateTime t2 = new DateTime(20);   
 if (DateTime.Compare(t1, t2) >   0) Console.WriteLine( "t1 >  t2 ");  
 if (DateTime.Compare(t1, t2) == 0) Console.WriteLine( "t1 == t2 ");  
 if (DateTime.Compare(t1, t2)  <  0) Console.WriteLine( "t1  < t2 ");   
------解决方案--------------------DateTime t1 = Convert.ToDateTine( "2007-07-16 10:35:00 "); 
 DateTime t2 = Convert.ToDateTine( "2007-08-17 12:00:00 ");   
 if (DateTime.Compare(t1, t2) >   0) Console.WriteLine( "t1 >  t2 ");  
 if (DateTime.Compare(t1, t2) == 0) Console.WriteLine( "t1 == t2 ");  
 if (DateTime.Compare(t1, t2)  <  0) Console.WriteLine( "t1  < t2 ");   
------解决方案--------------------DateTime dt1 = new (2007,7,16,10,35,00); 
 DateTime dt1 = new (2007,8,17,12,00,00); 
 if(dt1> dt2) 
 MessageBox.Show( "我比你大 ") 
 else 
 MessageBox.Show( "你比我大 ") 
------解决方案--------------------可直接使用 >   < = 运算符   
 DateTime t1 = DateTime.Now; 
 DateTime t2 = DateTime.Now;   
 bool eq = (t1==t2); // yes
------解决方案--------------------错了,   
 bool eq = (t1==t2); // 不一定相等,呵呵,