DateTime.TimeOfDay Property (System)

Switch View :
ScriptFree
.NET Framework Class Library
DateTime.TimeOfDay Property

Gets the time of day for this instance.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)
Syntax

Visual Basic
Public ReadOnly Property TimeOfDay As TimeSpan
C#
public TimeSpan TimeOfDay { get; }
Visual C++
public:
property TimeSpan TimeOfDay {
	TimeSpan get ();
}
F#
member TimeOfDay : TimeSpan

Property Value

Type: System.TimeSpan
A time interval that represents the fraction of the day that has elapsed since midnight.
Version Information

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library
Platforms

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
See Also

Reference

Community Content

Jim Harrison MSO Security
Elapsed time since Midnight is irrespective of time zone
@Peter,

You are mistaken.
0300 will always be 3 hours past midnight; regardless of the time zone in effect.

Peter Palotas
Misleading description
The description states that this method should return the time that has elapsed since midnight, while in fact it seems to just return the time portion of the date converted to a TimeSpan. For example due to daylight savings at 3:00 am on a particular date there may be only two hours elapsed since midnight, but this property would still return a timespan of 3:00.