Files
Kg.SeaTime/Service/Application.Service.Pub/Extends/TimeExtend.cs
2026-05-22 09:07:38 +08:00

24 lines
727 B
C#

namespace Application.Service.Pub;
public class TimeExtend
{
public static long GetTimeStampSeconds
{
get => Convert.ToInt64((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
}
public static long GetTimeStampMilliseconds
{
get => Convert.ToInt64((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalMilliseconds);
}
public static long GetTimeStampBySeconds(DateTime time)
{
return Convert.ToInt64((time - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
}
public static long GetTimeStampByMilliseconds(DateTime time)
{
return Convert.ToInt64((time - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalMilliseconds);
}
}