SoapDateTime.Parse(String) Method

Definition

Converts the specified String into a DateTime object.

public:
 static DateTime Parse(System::String ^ value);
public static DateTime Parse (string value);
static member Parse : string -> DateTime
Public Shared Function Parse (value As String) As DateTime

Parameters

value
String

The String to convert.

Returns

A DateTime object obtained from value.

Exceptions

One of the following:

  • value is an empty string.

  • value is null reference.

  • value does not contain a date and time that corresponds to any of the recognized format patterns.

Examples

The following code example shows how to use this method. This code example is part of a larger example that is provided for the SoapDateTime class.

// Parse an XSD dateTime to create a DateTime object.
String^ xsdDateTime = "2003-02-04T13:58:59.9999999+03:00";
DateTime dateTime = SoapDateTime::Parse( xsdDateTime );
// Parse an XSD dateTime to create a DateTime object.
string xsdDateTime = "2003-02-04T13:58:59.9999999+03:00";
DateTime dateTime = SoapDateTime.Parse(xsdDateTime);

Remarks

The Parse method is capable of parsing strings in various formats. The recognizable string formats are composed out of the following format patterns.

Format Pattern Description Examples
yyyy The year in 4-digit format. 1999, 1812
MM The numeric month. Single-digit months have a leading zero. 11, 05
dd The day of the month. Single-digit days have a leading zero. 23, 09
HH The hour within a 24-hour range. Single-digit hours have a leading zero. 17, 07
mm The minute. Single-digit minutes have a leading zero. 49, 05
ss The second. Single-digit seconds have a leading zero. 32, 02
f, ff, fff, ..., ffffffffff The fraction of a second. The number of 'f' characters in the pattern indicates the number of fraction digits. 321635, 4592
zzz The full time zone offset (hour and minutes) from the Universal Time Coordinate (Greenwich Mean Time). Single-digit hours have a leading zero. -07:00, 08:00

Applies to