C# Класс DateTimeEpochExtensions, extensions

Provides conversion of DateTime and DateTimeOffset into an epoch-relative number value (total seconds). See Unix Epoch in Wikipedia for more information on why this might be needed. Typical uses include using this simplified representation as an expiration time for a token, password or verification code.
Показать файл Открыть проект

Открытые методы

Метод Описание
ToDateTimeFromEpoch ( this secondsSince1970 ) : DateTime

Converts the given epoch time to a DateTime with DateTimeKind.Utc kind.

ToDateTimeOffsetFromEpoch ( this secondsSince1970 ) : DateTimeOffset

Converts the given epoch time to a UTC DateTimeOffset.

ToEpochTime ( this dateTime ) : long

Converts the given date value to epoch time.

Описание методов

ToDateTimeFromEpoch() публичный статический Метод

Converts the given epoch time to a DateTime with DateTimeKind.Utc kind.
public static ToDateTimeFromEpoch ( this secondsSince1970 ) : DateTime
secondsSince1970 this The seconds to convert
Результат DateTime

ToDateTimeOffsetFromEpoch() публичный статический Метод

Converts the given epoch time to a UTC DateTimeOffset.
public static ToDateTimeOffsetFromEpoch ( this secondsSince1970 ) : DateTimeOffset
secondsSince1970 this The seconds to convert
Результат DateTimeOffset

ToEpochTime() публичный статический Метод

Converts the given date value to epoch time.
public static ToEpochTime ( this dateTime ) : long
dateTime this The data to convert
Результат long