DateTimeOffset.FromUnixTimeMilliseconds(Int64) 方法

定義

將自 1970-01-01T00:00:00Z 以來所經過的 Unix 時間 (以毫秒數表示),轉換成 DateTimeOffset 值。Converts a Unix time expressed as the number of milliseconds that have elapsed since 1970-01-01T00:00:00Z to a DateTimeOffset value.

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

參數

milliseconds
Int64

自 1970-01-01T00:00:00Z (1970 年 1 月 1 日上午 12:00 UTC) 以來所經過的 Unix 時間 (以毫秒數表示)。A Unix time, expressed as the number of milliseconds that have elapsed since 1970-01-01T00:00:00Z (January 1, 1970, at 12:00 AM UTC). 若是在此日期之前的 Unix 時間點,其值為負數。For Unix times before this date, its value is negative.

傳回

DateTimeOffset

表示與 Unix 時間相同時間點的日期和時間值。A date and time value that represents the same moment in time as the Unix time.

例外狀況

milliseconds 小於 -62,135,596,800,000。milliseconds is less than -62,135,596,800,000.

-或--or- milliseconds 大於 253,402,300,799,999。milliseconds is greater than 253,402,300,799,999.

備註

Offset傳回之實例的屬性值 DateTimeOffsetTimeSpan.Zero ,表示國際標準時間。The Offset property value of the returned DateTimeOffset instance is TimeSpan.Zero, which represents Coordinated Universal Time. 您可以藉由呼叫方法,將它轉換為特定時區的時間 TimeZoneInfo.ConvertTime(DateTimeOffset, TimeZoneInfo)You can convert it to the time in a specific time zone by calling the TimeZoneInfo.ConvertTime(DateTimeOffset, TimeZoneInfo) method.

適用於

另請參閱