DateTimeOffset.UtcDateTime DateTimeOffset.UtcDateTime DateTimeOffset.UtcDateTime DateTimeOffset.UtcDateTime Property

定義

取得、DateTime世界協定時刻 (UTC) の日付と現在の時刻を表す値DateTimeOffsetオブジェクト。Gets a DateTime value that represents the Coordinated Universal Time (UTC) date and time of the current DateTimeOffset object.

public:
 property DateTime UtcDateTime { DateTime get(); };
public DateTime UtcDateTime { get; }
member this.UtcDateTime : DateTime
Public ReadOnly Property UtcDateTime As DateTime

プロパティ値

世界協定時刻 (UTC) の日付と現在の時刻DateTimeOffsetオブジェクト。The Coordinated Universal Time (UTC) date and time of the current DateTimeOffset object.

次の例を使用する方法を示しています、UtcDateTimeプロパティを表示、DateTimeOffset値とその対応する UTC 時刻。The following example shows how to use of the UtcDateTime property to display a DateTimeOffset value and its corresponding UTC time.

DateTimeOffset offsetTime = new DateTimeOffset(2007, 11, 25, 11, 14, 00, 
                            new TimeSpan(3, 0, 0));
Console.WriteLine("{0} is equivalent to {1} {2}", 
                  offsetTime.ToString(), 
                  offsetTime.UtcDateTime.ToString(), 
                  offsetTime.UtcDateTime.Kind.ToString());      
// The example displays the following output:
//       11/25/2007 11:14:00 AM +03:00 is equivalent to 11/25/2007 8:14:00 AM Utc      
Dim offsetTime As New DateTimeOffset(#11/25/2007 11:14AM#, _
                  New TimeSpan(3, 0, 0))
Console.WriteLine("{0} is equivalent to {1} {2}", _
                  offsetTime.ToString(), _
                  offsetTime.UtcDateTime.ToString(), _
                  offsetTime.UtcDateTime.Kind.ToString())      
' The example displays the following output:
'       11/25/2007 11:14:00 AM +03:00 is equivalent to 11/25/2007 8:14:00 AM Utc      

注釈

UtcDateTimeプロパティが 2 つの変換を実行します。The UtcDateTime property performs a dual conversion:

Kind 、返されたプロパティDateTime値に設定されてDateTimeKind.Utcします。The Kind property of the returned DateTime value is set to DateTimeKind.Utc.

値を取得、UtcDateTimeプロパティは、現在の呼び出しに相当DateTimeOffsetオブジェクトのToUniversalTime.DateTime点を除いて、プロパティ、Kind後者のプロパティDateTime値はDateTimeKind.Unspecifiedします。Retrieving the value of the UtcDateTime property is equivalent to calling the current DateTimeOffset object's ToUniversalTime.DateTime property, except that the Kind property of the latter DateTime value is DateTimeKind.Unspecified.

適用対象