Creates a DateTime from a String using specified formatting information.
[Visual Basic] Overloads Public Shared Function Parse( _ ByVal s As String, _ ByVal dtfi As DateTimeFormatInfo _ ) As DateTime [C#] public static DateTime Parse( string s, DateTimeFormatInfo dtfi ); [C++] public: static DateTime Parse( String* s, DateTimeFormatInfo* dtfi ); [JScript] public static function Parse( s : String, dtfi : DateTimeFormatInfo ) : DateTime;
The new DateTime.
Exception Type | Condition |
---|---|
ArgumentException | If the string is a null reference (in Visual Basic Nothing). |
FormatException | If the string does not contain a valid string representation of a date and time. |
The Parse and ParseExact methods each break the input into smaller chunks, but the ParseExact also looks for a specific (exact) string.
In order for the string to be successfully parsed, it must represent a date and/or time value in the universal format determined by the specified DateTimeFormatInfo object.
The dtfi object provides culture-specific date and time formatting information, such as the days of the week: "Sabado", "Domingo", "Lunes", etc.
Leading and trailing white space characters are allowed.
DateTime Structure | DateTime Members | System Namespace | DateTime.Parse Overload List | DateTimeFormatInfo | String | CultureInfo | DateTimeFormatInfo