ly/Common/DateTimeHelper.cs

24 lines
631 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

namespace LY.App.Common
{
/// <summary>
/// 日期时间帮助类
/// </summary>
public static class DateTimeHelper
{
/// <summary>
/// //当前剩余秒数
/// </summary>
/// <returns></returns>
public static int GetRemainSeconds()
{
// 当前时间
DateTime now = DateTime.Now;
// 当天结束时间23:59:59.999
DateTime endOfDay = now.Date.AddDays(1).AddTicks(-1);
int remainSeconds = (int)(endOfDay - DateTime.Now).TotalSeconds;
return remainSeconds;
}
}
}