mirror of
https://git.teknik.io/Teknikode/Teknik.git
synced 2023-08-02 14:16:22 +02:00
18 lines
380 B
C#
18 lines
380 B
C#
|
using System;
|
|||
|
|
|||
|
namespace Teknik.Utilities
|
|||
|
{
|
|||
|
public static class DateTimeHelper
|
|||
|
{
|
|||
|
public static int GetUnixTimestamp()
|
|||
|
{
|
|||
|
return DateTime.UtcNow.GetUnixTimestamp();
|
|||
|
}
|
|||
|
|
|||
|
public static int GetUnixTimestamp(this DateTime dt)
|
|||
|
{
|
|||
|
return (int)(dt.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|