1111
This commit is contained in:
24
Service/Application.Service.Pub/Extends/TimeExtend.cs
Normal file
24
Service/Application.Service.Pub/Extends/TimeExtend.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user