asp.net时间比较

 1         public static int DateDiffDay(DateTime DateTimeOld, DateTime DateTimeNew)

 2         {

 3             TimeSpan ts1 = new TimeSpan(DateTimeOld.Ticks);

 4             TimeSpan ts2 = new TimeSpan(DateTimeNew.Ticks);

 5             TimeSpan ts = ts1.Subtract(ts2).Duration();

 6             int day = ts.Days;

 7             if (day < -3)

 8                 return -1;

 9             else if (day == 0)

10                 return 1;

11             else return 0;

12         }

 

你可能感兴趣的:(asp.net)