Today Property

DateTime::Today Property


Gets the current date.

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

property DateTime Today {
	static DateTime get();

Property Value

Type: System::DateTime

An object that is set to today's date, with the time component set to 00:00:00.

Starting with the .NET Framework version 2.0, the return value is a DateTime whose Kind property returns Local.

Because it returns the current date without the current time, the Today property is suitable for use in applications that work with dates only. For details, see Choosing Between DateTime, DateTimeOffset, TimeSpan, and TimeZoneInfo. In contrast, the TimeOfDay property returns the current time without the current date, and the Now property returns both the current date and the current time.

The following example uses the Date property to retrieve the current date. It also illustrates how a DateTime value can be formatted using some of the standard date and time format strings. Note that the output produced by the third call to the ToString(String^) method uses the g format specifier to include the time component, which is zero.

No code example is currently available or this language may not be supported.

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