DateTimeOffset.TimeOfDay DateTimeOffset.TimeOfDay DateTimeOffset.TimeOfDay DateTimeOffset.TimeOfDay Property

定義

現在の日の時刻を取得DateTimeOffsetオブジェクト。Gets the time of day for the current DateTimeOffset object.

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

プロパティ値

現在の日付の午前 0 時からの経過時間。The time interval of the current date that has elapsed since midnight.

次の例では、TimeOfDayプロパティを時間を抽出し、それをコンソールに表示します。The following example uses the TimeOfDay property to extract the time and display it to the console.

DateTimeOffset currentDate = new DateTimeOffset(2008, 5, 10, 5, 32, 16, 
                                      DateTimeOffset.Now.Offset); 
TimeSpan currentTime = currentDate.TimeOfDay;
Console.WriteLine("The current time is {0}.", currentTime.ToString());
// The example produces the following output: 
//       The current time is 05:32:16.
Dim currentDate As New DateTimeOffset(#5/10/2008 5:32:16AM#, _
                                      DateTimeOffset.Now.Offset) 
Dim currentTime As TimeSpan = currentDate.TimeOfDay
Console.WriteLine("The current time is {0}.", currentTime.ToString())
' The example produces the following output: 
'       The current time is 05:32:16.

注釈

TimeOfDayプロパティがの値によって影響を受けません、Offsetプロパティ。The TimeOfDay property is not affected by the value of the Offset property.

TimeOfDayの時間コンポーネントを返します、DateTimeOffsetの形式でオブジェクトをTimeSpanオブジェクト。The TimeOfDay property returns the time component of a DateTimeOffset object in the form of a TimeSpan object. 同じになります、DateTime.TimeOfDayプロパティ。It is equivalent to the DateTime.TimeOfDay property.

適用対象