TryParse()

TimeSpan::TryParse(const String&, TimeSpan&) method

Converts string to equivalent TimeSpan object and returns result of conversion.

static bool System::TimeSpan::TryParse(const String &input, TimeSpan &result)

Arguments

ParameterTypeDescription
inputconst String&Input string.
resultTimeSpan&Time interval that corresponds to string.

Return Value

True if string was converted successfully; otherwise, false.

TimeSpan::TryParse(const String&, const SharedPtr<IFormatProvider>&, TimeSpan&) method

Converts string to equivalent TimeSpan object using the specified format provider and returns result of conversion.

static bool System::TimeSpan::TryParse(const String &input, const SharedPtr<IFormatProvider> &provider, TimeSpan &result)

Arguments

ParameterTypeDescription
inputconst String&Input string.
providerconst SharedPtr<IFormatProvider>&Format provider that supplies culture-specific formatting information.
resultTimeSpan&Time interval that corresponds to string.

Return Value

True if string was converted successfully; otherwise, false.

TimeSpan::TryParse(const String&, const SharedPtr<Globalization::CultureInfo>&, TimeSpan&) method

static bool System::TimeSpan::TryParse(const String &input, const SharedPtr<Globalization::CultureInfo> &culture, TimeSpan &result)

TimeSpan::TryParse(const String&, const SharedPtr<Globalization::DateTimeFormatInfo>&, TimeSpan&) method

static bool System::TimeSpan::TryParse(const String &input, const SharedPtr<Globalization::DateTimeFormatInfo> &dtfi, TimeSpan &result)

TimeSpan::TryParse(const String&, std::nullptr_t, TimeSpan&) method

static bool System::TimeSpan::TryParse(const String &input, std::nullptr_t, TimeSpan &result)

See Also