ToDateTime()
Contents
[
Hide
]XmlConvert::ToDateTime(const String&) method
Converts the String to a DateTime equivalent.
static DateTime System::Xml::XmlConvert::ToDateTime(const String &s)
Arguments
| Parameter | Type | Description |
|---|---|---|
| s | const String& | The string to convert. |
Return Value
A DateTime equivalent of the string.
Exceptions
| Exception | Description |
|---|---|
| ArgumentNullException | s is nullptr. |
| FormatException | s is an empty string or is not in the correct format. |
XmlConvert::ToDateTime(const String&, const String&) method
Converts the String to a DateTime equivalent.
static DateTime System::Xml::XmlConvert::ToDateTime(const String &s, const String &format)
Arguments
| Parameter | Type | Description |
|---|---|---|
| s | const String& | The string to convert. |
| format | const String& | The format structure to apply to the converted DateTime. Valid formats include “yyyy-MM-ddTHH:mm:sszzzzzz” and its subsets. The string is validated against this format. |
Return Value
A DateTime equivalent of the string.
Exceptions
| Exception | Description |
|---|---|
| ArgumentNullException | s is nullptr. |
| FormatException | s or format is String::Empty or s does not contain a date and time that corresponds to format. |
XmlConvert::ToDateTime(const String&, const ArrayPtr<String>&) method
Converts the String to a DateTime equivalent.
static DateTime System::Xml::XmlConvert::ToDateTime(const String &s, const ArrayPtr<String> &formats)
Arguments
| Parameter | Type | Description |
|---|---|---|
| s | const String& | The string to convert. |
| formats | const ArrayPtr<String>& | An array containing the format structures to apply to the converted DateTime. Valid formats include “yyyy-MM-ddTHH:mm:sszzzzzz” and its subsets. |
Return Value
A DateTime equivalent of the string.
Exceptions
| Exception | Description |
|---|---|
| ArgumentNullException | s is nullptr. |
| FormatException | s or an element of formats is String::Empty or s does not contain a date and time that corresponds to any of the elements of formats. |
XmlConvert::ToDateTime(const String&, XmlDateTimeSerializationMode) method
Converts the String to a DateTime using the XmlDateTimeSerializationMode specified.
static DateTime System::Xml::XmlConvert::ToDateTime(const String &s, XmlDateTimeSerializationMode dateTimeOption)
Arguments
| Parameter | Type | Description |
|---|---|---|
| s | const String& | The String value to convert. |
| dateTimeOption | XmlDateTimeSerializationMode | One of the enumeration values that specify whether the date should be converted to local time or preserved as Coordinated Universal Time (UTC), if it is a UTC date. |
Return Value
A DateTime equivalent of the String.
Exceptions
| Exception | Description |
|---|---|
| NullReferenceException | s is nullptr. |
| ArgumentNullException | dateTimeOption is nullptr. |
| FormatException | s is an empty string or is not in a valid format. |
See Also
- Enum XmlDateTimeSerializationMode
- Typedef ArrayPtr
- Class DateTime
- Class String
- Class XmlConvert
- Namespace System::Xml
- Library Aspose.Slides