DateTime.IConvertible.ToType(Type, IFormatProvider) Method

Definition

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

 virtual System::Object ^ System.IConvertible.ToType(Type ^ type, IFormatProvider ^ provider) = IConvertible::ToType;
object IConvertible.ToType (Type type, IFormatProvider provider);

Parameters

type
Type

The desired type.

provider
IFormatProvider

An object that implements the IFormatProvider interface. (This parameter is not used; specify null.)

Returns

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

Implements

Exceptions

type is null.

This conversion is not supported for the DateTime type.

Applies to

See also