Example #1
0
 public static int TotalHoursBetween(DateTime time1, DateTime time2) =>
 DateTimeSpan.CompareDates(time1, time2).Hours;
Example #2
0
 public static int TotalDaysBetween(DateTime time1, DateTime time2) =>
 DateTimeSpan.CompareDates(time1, time2).Days;
Example #3
0
 public static int TotalMonthsBetween(DateTime time1, DateTime time2) =>
 DateTimeSpan.CompareDates(time1, time2).Months +
 DateTimeSpan.CompareDates(time1, time2).Years * 12;
Example #4
0
 public static int TotalWeeksBetween(DateTime time1, DateTime time2) =>
 (int)Math.Ceiling(DateTimeSpan.CompareDates(time1, time2).Days / 7d);
Example #5
0
 public static int TotalMillisecondsBetween(DateTime time1, DateTime time2) =>
 DateTimeSpan.CompareDates(time1, time2).Milliseconds;
Example #6
0
 public static int TotalMinutesBetween(DateTime time1, DateTime time2) =>
 DateTimeSpan.CompareDates(time1, time2).Minutes;