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, DateTimeFormatInfo)

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;

Parameters

s
A string containing a date and time.
dtfi
The DateTimeFormatInfo instance used to parse the string.

Return Value

The new DateTime.

Exceptions

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.

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/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.

See Also

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