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.

C#
public static bool TryParseExact(string? s, string?[]? formats, IFormatProvider? provider, System.Globalization.DateTimeStyles style, out DateOnly result);

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

.NET 10 a ďalšie verzie
Produkt Verzie
.NET 6, 7, 8, 9, 10

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.

C#
public static bool TryParseExact(ReadOnlySpan<char> s, ReadOnlySpan<char> format, out DateOnly result);

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

.NET 10 a ďalšie verzie
Produkt Verzie
.NET 6, 7, 8, 9, 10

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.

C#
public static bool TryParseExact(ReadOnlySpan<char> s, string?[]? formats, out DateOnly result);

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

.NET 10 a ďalšie verzie
Produkt Verzie
.NET 6, 7, 8, 9, 10

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.

C#
public static bool TryParseExact(string? s, string? format, out DateOnly result);

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

.NET 10 a ďalšie verzie
Produkt Verzie
.NET 6, 7, 8, 9, 10

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.

C#
public static bool TryParseExact(string? s, string?[]? formats, out DateOnly result);

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

.NET 10 a ďalšie verzie
Produkt Verzie
.NET 6, 7, 8, 9, 10

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.

C#
public static bool TryParseExact(ReadOnlySpan<char> s, ReadOnlySpan<char> format, IFormatProvider? provider, System.Globalization.DateTimeStyles style, out DateOnly result);

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

.NET 10 a ďalšie verzie
Produkt Verzie
.NET 6, 7, 8, 9, 10

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.

C#
public static bool TryParseExact(ReadOnlySpan<char> s, string?[]? formats, IFormatProvider? provider, System.Globalization.DateTimeStyles style, out DateOnly result);

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

.NET 10 a ďalšie verzie
Produkt Verzie
.NET 6, 7, 8, 9, 10

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.

C#
public static bool TryParseExact(string? s, string? format, IFormatProvider? provider, System.Globalization.DateTimeStyles style, out DateOnly result);

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

.NET 10 a ďalšie verzie
Produkt Verzie
.NET 6, 7, 8, 9, 10