NoSugarNet/NoSugarNet.ClientCore.Standard2/Common/Helper.cs
2024-10-18 16:47:32 +08:00

23 lines
517 B
C#

using System;
namespace NoSugarNet.ClientCore.Common
{
public static class Helper
{
public static long GetNowTimeStamp()
{
return GetTimeStamp(DateTime.Now);
}
/// <summary>
/// 获取时间戳
/// </summary>
/// <returns></returns>
public static long GetTimeStamp(DateTime dt)
{
TimeSpan ts = dt - new DateTime(1970, 1, 1, 0, 0, 0, 0);
return Convert.ToInt64(ts.TotalSeconds);
}
}
}