Editare

Partajați prin


DateTimeOffset.FromUnixTimeSeconds(Int64) Method

Definition

Converts a Unix time expressed as the number of seconds that have elapsed since 1970-01-01T00:00:00Z to a DateTimeOffset value.

public:
 static DateTimeOffset FromUnixTimeSeconds(long seconds);
public static DateTimeOffset FromUnixTimeSeconds (long seconds);
static member FromUnixTimeSeconds : int64 -> DateTimeOffset
Public Shared Function FromUnixTimeSeconds (seconds As Long) As DateTimeOffset

Parameters

seconds
Int64

A Unix time, expressed as the number of seconds that have elapsed since 1970-01-01T00:00:00Z (January 1, 1970, at 12:00 AM UTC). For Unix times before this date, its value is negative.

Returns

A date and time value that represents the same moment in time as the Unix time.

Exceptions

seconds is less than -62,135,596,800.

-or-

seconds is greater than 253,402,300,799.

Remarks

The Offset property value of the returned DateTimeOffset instance is TimeSpan.Zero, which represents Coordinated Universal Time. You can convert it to the time in a specific time zone by calling the TimeZoneInfo.ConvertTime(DateTimeOffset, TimeZoneInfo) method.

Applies to

See also