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

◆ try_parse()

static bool xtd::date_time::try_parse ( const ustring s,
date_time result 
)
staticnoexcept

Converts the specified string representation of a date and time to its xtd::date_time equivalent and returns a value that indicates whether the conversion succeeded.

Parameters
sA string containing a date and time to convert.
resultWhen this method returns, contains the xtd::date_time value equivalent to the date and time contained in s, if the conversion succeeded, or xtd::date_time::min_value if the conversion failed. The conversion fails if the s parameter is an empty string (""), or does not contain a valid string representation of a date and time.
Returns
true if the s parameter was converted successfully; otherwise, false.
Remarks
The xtd::date_time::try_parse method is similar to the xtd::date_time::parse method, except that the xtd::date_time::try_parse method does not throw an exception if the conversion fails.