System.DateTime.TimeOfDay Property

Gets the time of day for this instance.

Syntax

public TimeSpan TimeOfDay { get; }

Value

A TimeSpan instance set to the time component of the current instance.

Remarks

Unlike the DateTime.Date property. which returns a DateTime value that represents a date without its time component, the DateTime.TimeOfDay property returns a TimeSpan value that represents a DateTime value's time component.

If you want to display the time of day or retrieve the string representation of the time of day of a DateTime value, you can instead call an overload of the DateTime.ToString(string) method that has a format parameter or use the composite formatting feature with the "t" or "T" standard format string.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0