Modifier

Partager via


DateOnly.TryParseExact Method

Definition

Overloads

TryParseExact(String, String[], IFormatProvider, DateTimeStyles, DateOnly)

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

TryParseExact(ReadOnlySpan<Char>, ReadOnlySpan<Char>, DateOnly)

Converts the specified span representation of a date to its DateOnly equivalent using the specified format and style. The format of the string representation must match the specified format exactly. The method returns a value that indicates whether the conversion succeeded.

TryParseExact(ReadOnlySpan<Char>, String[], DateOnly)

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

TryParseExact(String, String, DateOnly)

Converts the specified string representation of a date to its DateOnly equivalent using the specified format and style. The format of the string representation must match the specified format exactly. The method returns a value that indicates whether the conversion succeeded.

TryParseExact(String, String[], DateOnly)

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

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

Converts the specified span representation of a date to its DateOnlyequivalent using the specified format, culture-specific format information, and style. The format of the string representation must match the specified format exactly. The method returns a value that indicates whether the conversion succeeded.

TryParseExact(ReadOnlySpan<Char>, String[], IFormatProvider, DateTimeStyles, DateOnly)

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

TryParseExact(String, String, IFormatProvider, DateTimeStyles, DateOnly)

Converts the specified span representation of a date to its DateOnly equivalent using the specified format, culture-specific format information, and style. The format of the string representation must match the specified format exactly. The method returns a value that indicates whether the conversion succeeded.

TryParseExact(String, String[], IFormatProvider, DateTimeStyles, DateOnly)

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

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

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

Parameters

s
String

The string containing the date to parse.

formats
String[]

An array of allowable formats of s.

provider
IFormatProvider

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

style
DateTimeStyles

A bitwise combination of enumeration values that defines how to interpret the parsed date. 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 s is an empty string, or does not contain a valid string representation of a date. This parameter is passed uninitialized.

Returns

true if s was converted successfully; otherwise, false.

Applies to

TryParseExact(ReadOnlySpan<Char>, ReadOnlySpan<Char>, 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 format and style. The format of the string representation must match the specified format exactly. The method returns a value that indicates whether the conversion succeeded.

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

Parameters

s
ReadOnlySpan<Char>

A span containing the characters representing a date to convert.

format
ReadOnlySpan<Char>

The required format of s.

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 is an empty string, or does not contain a date that correspond to the pattern specified in format. This parameter is passed uninitialized.

Returns

true if s was converted successfully; otherwise, false.

Applies to

TryParseExact(ReadOnlySpan<Char>, String[], DateOnly)

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

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

public:
 static bool TryParseExact(ReadOnlySpan<char> s, cli::array <System::String ^> ^ formats, [Runtime::InteropServices::Out] DateOnly % result);
public static bool TryParseExact (ReadOnlySpan<char> s, string?[]? formats, out DateOnly result);
static member TryParseExact : ReadOnlySpan<char> * string[] * DateOnly -> bool
Public Shared Function TryParseExact (s As ReadOnlySpan(Of Char), formats As String(), ByRef result As DateOnly) As Boolean

Parameters

s
ReadOnlySpan<Char>

The span containing the string to parse.

formats
String[]

An array of allowable formats of s.

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 an empty string, or does not contain a valid string representation of a date. This parameter is passed uninitialized.

Returns

true ifs was converted successfully; otherwise, false.

Applies to

TryParseExact(String, String, 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 format and style. The format of the string representation must match the specified format exactly. The method returns a value that indicates whether the conversion succeeded.

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

Parameters

s
String

A string containing the characters representing a date to convert.

format
String

The required format of s.

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 s is an empty string, or does not contain a date that correspond to the pattern specified in format. This parameter is passed uninitialized.

Returns

true if s was converted successfully; otherwise, false.

Applies to

TryParseExact(String, String[], DateOnly)

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

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

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

Parameters

s
String

The string containing date to parse.

formats
String[]

An array of allowable formats of s.

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 s is an empty string, or does not contain a valid string representation of a date. This parameter is passed uninitialized.

Returns

true if s was converted successfully; otherwise, false.

Applies to

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

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

Converts the specified span representation of a date to its DateOnlyequivalent using the specified format, culture-specific format information, and style. The format of the string representation must match the specified format exactly. The method returns a value that indicates whether the conversion succeeded.

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

Parameters

s
ReadOnlySpan<Char>

A span containing the characters representing a date to convert.

format
ReadOnlySpan<Char>

The required format of s.

provider
IFormatProvider

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

style
DateTimeStyles

A bitwise combination of one or more enumeration values that indicate the permitted format of s.

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 is an empty string, or does not contain a date that correspond to the pattern specified in format. This parameter is passed uninitialized.

Returns

true if s was converted successfully; otherwise, false.

Applies to

TryParseExact(ReadOnlySpan<Char>, String[], IFormatProvider, DateTimeStyles, DateOnly)

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

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

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

Parameters

s
ReadOnlySpan<Char>

The span containing the string to parse.

formats
String[]

An array of allowable formats of s.

provider
IFormatProvider

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

style
DateTimeStyles

A bitwise combination of enumeration values that defines how to interpret the parsed date. 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 s is an empty string, or does not contain a valid string representation of a date. This parameter is passed uninitialized.

Returns

true if s was converted successfully; otherwise, false.

Applies to

TryParseExact(String, String, 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 format, culture-specific format information, and style. The format of the string representation must match the specified format exactly. The method returns a value that indicates whether the conversion succeeded.

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

Parameters

s
String

A span containing the characters representing a date to convert.

format
String

The required format of s.

provider
IFormatProvider

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

style
DateTimeStyles

A bitwise combination of one or more enumeration values that indicate the permitted format of s.

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 s is an empty string, or does not contain a date that correspond to the pattern specified in format. This parameter is passed uninitialized.

Returns

true if s was converted successfully; otherwise, false.

Applies to