SoapDateTime.Parse(String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
- value
- String
The String
to convert.
A DateTime object obtained from value
.
One of the following:
value
is an empty string.value
isnull
reference.value
does not contain a date and time that corresponds to any of the recognized format patterns.
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);
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
Product | Versions |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: