老阴阳人了

导航

C#时间进行比较

  DateTime   t1   =   new   DateTime(100);   
  DateTime   t2   =   new   DateTime(20);   
  //t1比t2大    
  if   (DateTime.Compare(t1,   t2)   >     0)   Console.WriteLine("t1   >   t2");  
//t1和t2相等 if (DateTime.Compare(t1, t2) == 0) Console.WriteLine("t1 == t2");
//t1比t2小 if (DateTime.Compare(t1, t2) < 0) Console.WriteLine("t1 < t2");

posted on 2020-08-12 16:47  老阴阳人了  阅读(510)  评论(0编辑  收藏  举报