C# Класс HermaFx.DateTimeEpochExtensions

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.
Показать файл Открыть проект

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

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

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

ToDateTimeOffset ( this secondsSince1970 ) : DateTimeOffset

Converts the given epoch time to a UTC DateTimeOffset.

ToUnixTime ( this dateTime ) : long

Converts the given date value to epoch/unix time.

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

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

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

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

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

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

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