Poszukiwacz/Serwer/Serwer.Infrastructure/Extentions/Extentions.cs
2020-12-06 18:31:05 +01:00

20 lines
479 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Serwer.Infrastructure.Extentions
{
public static class Extentions
{
public static long ToTimestamp(this DateTime dateTime)
{
var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
var time = dateTime.Ticks - epoch.Ticks;
return time / TimeSpan.TicksPerSecond;
}
}
}