DateTime::IConvertible::ToType Method

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Converts the current DateTime object to an object of a specified type.

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

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

Parameters

type
Type: System::Type
The desired type.
provider
Type: System::IFormatProvider
An object that implements the IFormatProvider interface. (This parameter is not used; specify nullptr.)

Return Value

Type: System::Object
An object of the type specified by the type parameter, with a value equivalent to the current DateTime object.

Implements

IConvertible::ToType(Type, IFormatProvider)

ExceptionCondition
ArgumentNullException

type is nullptr.

InvalidCastException

This conversion is not supported for the DateTime type.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show: