DateTime compare
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.Compare(datetime1,datetime2)的输入为-1,0,1
值类型 条件
小于零 t1 小于 t2
零 t1 等于 t2
大于零 t1 大于 t2
http://msdn.microsoft.com/zh-cn/library/system.datetime.compare(v=VS.80).aspx