DateOnly.TryParse Method

Definition

Overloads

TryParse(String, IFormatProvider, DateTimeStyles, DateOnly)

Converts the specified string representation of a date to its DateOnly equivalent using the specified array of formats, culture-specific format information, and style. And returns a value that indicates whether the conversion succeeded.

TryParse(ReadOnlySpan<Char>, IFormatProvider, DateTimeStyles, DateOnly)

Converts the specified span representation of a date to its DateOnly equivalent using the specified array of formats, culture-specific format information, and style. And returns a value that indicates whether the conversion succeeded.

TryParse(ReadOnlySpan<Char>, DateOnly)

Converts the specified span representation of a date to its DateOnly equivalent and returns a value that indicates whether the conversion succeeded.

TryParse(String, DateOnly)

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

TryParse(String, IFormatProvider, DateTimeStyles, DateOnly)

Converts the specified string representation of a date to its DateOnly equivalent using the specified array of formats, culture-specific format information, and style. And returns a value that indicates whether the conversion succeeded.

public:
 static bool TryParse(System::String ^ s, IFormatProvider ^ provider, System::Globalization::DateTimeStyles style, [Runtime::InteropServices::Out] DateOnly % result);
public static bool TryParse (string? s, IFormatProvider? provider, System.Globalization.DateTimeStyles style, out DateOnly result);
static member TryParse : string * IFormatProvider * System.Globalization.DateTimeStyles * DateOnly -> bool
Public Shared Function TryParse (s As String, provider As IFormatProvider, style As DateTimeStyles, ByRef result As DateOnly) As Boolean

Parameters

s
String

A string containing the characters that represent a date to convert.

provider
IFormatProvider

An object that supplies culture-specific formatting information about s.

style
DateTimeStyles

A bitwise combination of enumeration values that indicates the permitted format of s. A typical value to specify is None.

result
DateOnly

When this method returns, contains the DateOnly value equivalent to the date contained in s, if the conversion succeeded, or MinValue if the conversion failed. The conversion fails if the s parameter is empty string, or does not contain a valid string representation of a date. This parameter is passed uninitialized.

Returns

Boolean

true if the conversion was successful; otherwise, false.

Applies to

TryParse(ReadOnlySpan<Char>, IFormatProvider, DateTimeStyles, DateOnly)

Converts the specified span representation of a date to its DateOnly equivalent using the specified array of formats, culture-specific format information, and style. And returns a value that indicates whether the conversion succeeded.

public:
 static bool TryParse(ReadOnlySpan<char> s, IFormatProvider ^ provider, System::Globalization::DateTimeStyles style, [Runtime::InteropServices::Out] DateOnly % result);
public static bool TryParse (ReadOnlySpan<char> s, IFormatProvider? provider, System.Globalization.DateTimeStyles style, out DateOnly result);
static member TryParse : ReadOnlySpan<char> * IFormatProvider * System.Globalization.DateTimeStyles * DateOnly -> bool
Public Shared Function TryParse (s As ReadOnlySpan(Of Char), provider As IFormatProvider, style As DateTimeStyles, ByRef result As DateOnly) As Boolean

Parameters

s
ReadOnlySpan<Char>

A string containing the characters that represent a date to convert.

provider
IFormatProvider

An object that supplies culture-specific formatting information about s.

style
DateTimeStyles

A bitwise combination of enumeration values that indicates the permitted format of s. A typical value to specify is None.

result
DateOnly

When this method returns, contains the DateOnly value equivalent to the date contained in s, if the conversion succeeded, or MinValue if the conversion failed. The conversion fails if the s parameter is empty string, or does not contain a valid string representation of a date. This parameter is passed uninitialized.

Returns

Boolean

true if the conversion was successful; otherwise, false.

Applies to

TryParse(ReadOnlySpan<Char>, DateOnly)

Converts the specified span representation of a date to its DateOnly equivalent and returns a value that indicates whether the conversion succeeded.

public:
 static bool TryParse(ReadOnlySpan<char> s, [Runtime::InteropServices::Out] DateOnly % result);
public static bool TryParse (ReadOnlySpan<char> s, out DateOnly result);
static member TryParse : ReadOnlySpan<char> * DateOnly -> bool
Public Shared Function TryParse (s As ReadOnlySpan(Of Char), ByRef result As DateOnly) As Boolean

Parameters

s
ReadOnlySpan<Char>

A span containing the characters representing the date to convert.

result
DateOnly

When this method returns, contains the DateOnly value equivalent to the date contained in s, if the conversion succeeded, or MinValue if the conversion failed. The conversion fails if the s parameter is empty string, or does not contain a valid string representation of a date. This parameter is passed uninitialized.

Returns

Boolean

true if the conversion was successful; otherwise, false.

Applies to

TryParse(String, DateOnly)

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

public:
 static bool TryParse(System::String ^ s, [Runtime::InteropServices::Out] DateOnly % result);
public static bool TryParse (string? s, out DateOnly result);
static member TryParse : string * DateOnly -> bool
Public Shared Function TryParse (s As String, ByRef result As DateOnly) As Boolean

Parameters

s
String

A string containing the characters representing the date to convert.

result
DateOnly

When this method returns, contains the DateOnly value equivalent to the date contained in s, if the conversion succeeded, or MinValue if the conversion failed. The conversion fails if the s parameter is empty string, or does not contain a valid string representation of a date. This parameter is passed uninitialized.

Returns

Boolean

true if the conversion was successful; otherwise, false.

Applies to