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.
파일 보기 프로젝트 열기: netfx/extensions

공개 메소드들

메소드 설명
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