TimeDiff.cs 515 B

1234567891011121314151617181920212223
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace Azylee.Core.DataUtils.DateTimeUtils
  6. {
  7. /// <summary>
  8. /// 时间差
  9. /// </summary>
  10. public static class TimeDiff
  11. {
  12. /// <summary>
  13. /// 当前时间差(秒)
  14. /// </summary>
  15. /// <param name="dt"></param>
  16. /// <returns></returns>
  17. public static long Sec(DateTime dt)
  18. {
  19. return (long)(dt - DateTime.Now).TotalSeconds;
  20. }
  21. }
  22. }