Returns the specified string converted to a DateTime value.
- s
- A string containing a value to convert. The string is interpreted using the System.Globalization.DateTimeStyles.None style.
The DateTime value obtained from s.
Type Reason ArgumentNullException s is a null reference. FormatException s does not contain a valid string representation of a time or date and time.
This version of DateTime.Parse(string) is equivalent to DateTime.Parse(string)(s, null, System.Globalization.DateTimeStyles.None ).
The string s is parsed using the formatting information in a System.Globalization.DateTimeFormatInfo initialized for the current system culture.
In order for the string to be successfully parsed, it is required to represent a date and time value in one of the standard DateTime patterns described in System.Globalization.DateTimeFormatInfo .
If the string contains only a time, and no date, then the current date (DateTime.Now ) is used. If the string contains only a date and no time, this method assumes 12 a.m.
Any leading, trailing, and inner white space characters are ignored.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0