| 123456789101112131415161718192021222324252627 |
- namespace SHJX.Service.Control.Extends
- {
- public static class ExtendMethod
- {
- public static double GetHourDifferenceValue(this DateTime time)
- {
- TimeSpan timeSpan = DateTime.Now - time;
- double hours = timeSpan.Hours + timeSpan.Minutes / 60.0 + timeSpan.Seconds / 60.0 / 60.0;
- return hours;
- }
- public static double GetMinDifferenceValue(this DateTime time)
- {
- TimeSpan timeSpan = DateTime.Now - time;
- double minutes = (timeSpan.Hours * 60.0) + timeSpan.Minutes + (timeSpan.Seconds / 60.0);
- return minutes;
- }
- public static int GetSecondDifferenceValue(this DateTime time)
- {
- TimeSpan timeSpan = DateTime.Now - time;
- int second = (timeSpan.Hours * 60 * 60) + (timeSpan.Minutes * 60) + timeSpan.Seconds;
- return second;
- }
- }
- }
|