NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DateTime.Parse (String)

Creates a DateTime from a string.

[Visual Basic]
Overloads Public Shared Function Parse( _
   ByVal s As String _
) As DateTime
[C#]
public static DateTime Parse(
   string s
);
[C++]
public: static DateTime Parse(
   String* s
);
[JScript]
public static function Parse(
   s : String
) : DateTime;

Parameters

s
A string containing a date and a time.

Return Value

A new DateTime.

Exceptions

Exception Type Condition
ArgumentNullException If s is a null reference (in Visual Basic Nothing).
FormatException If s does not contain a valid string representation and therefore cannot be parsed according to the DateTimeFormatInfo object used.

Remarks

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 time value in either of:

Leading and trailing white space characters are allowed.

See Also

DateTime Structure | DateTime Members | System Namespace | DateTime.Parse Overload List | String | DateTimeFormatInfo | DateTimeFormat | CultureInfo