Mono Class Library: System.Convert Overview | Members

System.Convert.ToDateTime Method

Converts a string to a DateTime structure.

public static DateTime ToDateTime (string value, IFormatProvider provider)

Parameters

value
The string to be converted.
provider
A IFormatProvider that supplies a System.Globalization.DateTimeFormatInfo containing culture-specific formatting information.

Returns

value as a DateTime.

Exceptions

TypeReason
ArgumentExceptionvalue is a null reference.
FormatExceptionvalue cannot be converted to a DateTime .

Remarks

This method parses value using the information in the System.Globalization.DateTimeFormatInfo instance supplied by provider. If provider is null or if a System.Globalization.DateTimeFormatInfo cannot be obtained from provider, the string is parsed using the formatting information of the current system culture.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0