DateTimeOffset.TimeOfDay Property
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets the time of day for the current DateTimeOffset object.
Assembly: mscorlib (in mscorlib.dll)
Property Value
Type: System.TimeSpanAn object that represents the time interval of the current date that has elapsed since midnight.
The TimeOfDay property is not affected by the value of the Offset property.
The TimeOfDay property returns the time component of a DateTimeOffset object in the form of a TimeSpan object. It is equivalent to the DateTime.TimeOfDay property.
The following example uses the TimeOfDay property to extract the time and display it to the console.
Dim currentDate As New DateTimeOffset(#5/10/2008 5:32:16 AM#, _ DateTimeOffset.Now.Offset) Dim currentTime As TimeSpan = currentDate.TimeOfDay outputBlock.Text &= String.Format("The current time is {0}.", currentTime.ToString()) & vbCrLf ' The example produces the following output: ' The current time is 05:32:16.