20 lines
479 B
C#
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;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|