Mono Class Library: System.DateTime Overview | MembersSystem.DateTime.Parse Method |
Returns the specified string converted to a DateTime value. [Edit]
|
- s
- A string containing the value to convert. [Edit]
- provider
- A IFormatProvider that supplies a System.Globalization.DateTimeFormatInfo object containing culture-specific format information about s . [Edit]
- styles
- One or more System.Globalization.DateTimeStyles values that specify the style of s. Specify multiple values for styles using the bitwise OR operator. [Edit]
- styles
- Documentation for this section has not yet been entered. [Edit]
The DateTime value obtained from s. [Edit]
Type Reason ArgumentException s is a null reference. [Edit] FormatException s does not contain a valid string representation of a time or date and time. [Edit]
The string s is parsed using the culture-specific formatting information from the System.Globalization.DateTimeFormatInfo instance supplied by provider. If provider is null or a System.Globalization.DateTimeFormatInfo cannot be obtained from provider, the formatting information for the current system culture is used.
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, and if the styles parameter is set to System.Globalization.DateTimeStyles.NoCurrentDateDefault the Gregorian year 1, month 1, day 1 are used. In all other cases where a date is not specified, the current date (DateTime.Now ) is used.
If the string contains only a date and no time, this method assumes 12 a.m.
For all settings of the styles parameter, any leading, trailing, and inner white space characters are ignored.
[Edit]
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0