Date Property

DateTime.Date Property


Gets the date component of this instance.

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

public DateTime Date { get; }

Property Value

Type: System.DateTime

A new object with the same date as this instance, and the time value set to 12:00:00 midnight (00:00:00).

The value of the Kind property of the returned DateTime value is the same as that of the current instance.

Because the DateTime type represents both dates and times in a single type, it is important to avoid misinterpreting a date returned by the Date property as a date and time.

The following example uses the Date property to extract the date component of a DateTime value with its time component set to zero (or 0:00:00, or midnight). It also illustrates that, depending on the format string used when displaying the DateTime value, the time component can continue to appear in formatted output.

using System;
using System.Management;

public class Sample 
    public static void Main() 

        // Get the WMI class
        ManagementClass processClass = 
            new ManagementClass("Win32_Process");

        ManagementObjectCollection classObjects;
        classObjects = processClass.GetInstances();

        foreach (ManagementObject classObject in


Universal Windows Platform
Available since 4.5
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
© 2015 Microsoft