This documentation is archived and is not being maintained.

DateTimeOffset.Date Property

Gets a DateTime value that represents the date component of the current DateTimeOffset object.

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

member Date : DateTime

Property Value

Type: System.DateTime
A DateTime value that represents the date component of the current DateTimeOffset object.

This property removes any significant part of the time component from a DateTimeOffset object and returns only its significant date component. For example, if the DateTimeOffset object has a date and time value of "1/12/07 4:01pm +7:30", the property returns a DateTime value of "1/12/07 12:00:00 AM". The DateTime value can then be displayed by using any of the standard or custom format specifiers that display dates only. (See the Example section for an illustration.)

The value of the DateTime.Kind property of the returned DateTime object is always DateTimeKind.Unspecified. It is not affected by the value of the Offset property.

To display a date without its time component, you can also use the "D" or "d" format specifiers; for an illustration, see the Example section.

The following example retrieves the value of the Date property for a specific date. It then displays that value to the console using some standard and custom date-only format specifiers.

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

.NET Framework

Supported in: 4, 3.5 SP1, 3.0 SP1, 2.0 SP1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

Windows 7, Windows Vista SP1 or later, Windows XP SP3, 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.