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(String, IFormatProvider, DateOnly)

Tries to parse a string into a value.

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(ReadOnlySpan<Char>, IFormatProvider, DateOnly)

Tries to parse a span of characters into a value.

TryParse(String, IFormatProvider, DateTimeStyles, DateOnly)

Source:
DateOnly.cs
Source:
DateOnly.cs
Source:
DateOnly.cs

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 DateOnly.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

true if the conversion was successful; otherwise, false.

Applies to

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

Source:
DateOnly.cs
Source:
DateOnly.cs
Source:
DateOnly.cs

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 DateOnly.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

true if the conversion was successful; otherwise, false.

Applies to

TryParse(String, IFormatProvider, DateOnly)

Source:
DateOnly.cs
Source:
DateOnly.cs
Source:
DateOnly.cs

Tries to parse a string into a value.

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

Parameters

s
String

The string to parse.

provider
IFormatProvider

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

result
DateOnly

When this method returns, contains the result of successfully parsing s or an undefined value on failure.

Returns

true if s was successfully parsed; otherwise, false.

Applies to

TryParse(ReadOnlySpan<Char>, DateOnly)

Source:
DateOnly.cs
Source:
DateOnly.cs
Source:
DateOnly.cs

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 DateOnly.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

true if the conversion was successful; otherwise, false.

Applies to

TryParse(String, DateOnly)

Source:
DateOnly.cs
Source:
DateOnly.cs
Source:
DateOnly.cs

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 DateOnly.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

true if the conversion was successful; otherwise, false.

Applies to

TryParse(ReadOnlySpan<Char>, IFormatProvider, DateOnly)

Source:
DateOnly.cs
Source:
DateOnly.cs
Source:
DateOnly.cs

Tries to parse a span of characters into a value.

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

Parameters

s
ReadOnlySpan<Char>

The span of characters to parse.

provider
IFormatProvider

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

result
DateOnly

When this method returns, contains the result of successfully parsing s, or an undefined value on failure.

Returns

true if s was successfully parsed; otherwise, false.

Applies to