xtd 0.2.0
Loading...
Searching...
No Matches

◆ parse()

static date_time xtd::date_time::parse ( const xtd::ustring s)
static

Converts the string representation of a date and time to its xtd::date_time equivalent by using the conventions of the current culture.

Parameters
sA string that contains a date and time to convert. See The string to parse for more information.
Returns
An object that is equivalent to the date and time contained in s.
Exceptions
xtd::format_exceptions does not contain a valid string representation of a date and time.
Remarks
If s contains time zone information, this method returns a xtd::date_time value whose xtd::date_time::kind property is xtd::date_time_kind::local and converts the date and time in s to local time. Otherwise, it performs no time zone conversion and returns a xtd::date_time value whose Kind property is DateTimeKind.Unspecified.
This overload attempts to parse s by using the formatting conventions of the current culture. The current culture is indicated by the CurrentCulture property. To parse a string using the formatting conventions of a specific culture, call the Parse(String, IFormatProvider) or the Parse(String, IFormatProvider, DateTimeStyles) overloads.
This overload attempts to parse s by using DateTimeStyles.AllowWhiteSpaces style.