संपादित करें

इसके माध्यम से साझा किया गया


DateOnly.ParseExact Method

Definition

Overloads

ParseExact(String, String[], IFormatProvider, DateTimeStyles)

Converts the specified string representation of a date to its DateOnly equivalent using the specified array of formats, culture-specific format information, and style. The format of the string representation must match at least one of the specified formats exactly or an exception is thrown.

ParseExact(String, String, IFormatProvider, DateTimeStyles)

Converts the specified string 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 or an exception is thrown.

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

Converts the specified span representation of a date to its DateOnly equivalent using the specified array of formats, culture-specific format information, and style. The format of the string representation must match at least one of the specified formats exactly or an exception is thrown.

ParseExact(ReadOnlySpan<Char>, String[])

Converts the specified span representation of a date to its DateOnly equivalent using the specified array of formats. The format of the string representation must match at least one of the specified formats exactly or an exception is thrown.

ParseExact(String, String[])

Converts the specified span representation of a date to its DateOnly equivalent using the specified array of formats. The format of the string representation must match at least one of the specified formats exactly or an exception is thrown.

ParseExact(String, String)

Converts the specified string representation of a date to its DateOnly equivalent using the specified format. The format of the string representation must match the specified format exactly or an exception is thrown.

ParseExact(ReadOnlySpan<Char>, ReadOnlySpan<Char>, IFormatProvider, DateTimeStyles)

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 or an exception is thrown.

ParseExact(String, String[], IFormatProvider, DateTimeStyles)

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. The format of the string representation must match at least one of the specified formats exactly or an exception is thrown.

public static DateOnly ParseExact (string s, string[] formats, IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None);
static member ParseExact : string * string[] * IFormatProvider * System.Globalization.DateTimeStyles -> DateOnly
Public Shared Function ParseExact (s As String, formats As String(), provider As IFormatProvider, Optional style As DateTimeStyles = System.Globalization.DateTimeStyles.None) As DateOnly

Parameters

s
String

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

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 indicates the permitted format of s. A typical value to specify is None.

Returns

An object that is equivalent to the date contained in s, as specified by format, provider, and style.

Exceptions

s does not contain a valid string representation of a date.

Applies to

ParseExact(String, String, IFormatProvider, DateTimeStyles)

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, culture-specific format information, and style. The format of the string representation must match the specified format exactly or an exception is thrown.

public static DateOnly ParseExact (string s, string format, IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None);
static member ParseExact : string * string * IFormatProvider * System.Globalization.DateTimeStyles -> DateOnly
Public Shared Function ParseExact (s As String, format As String, provider As IFormatProvider, Optional style As DateTimeStyles = System.Globalization.DateTimeStyles.None) As DateOnly

Parameters

s
String

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

format
String

A string containing the characters that represent a format specifier that defines the required format of s.

provider
IFormatProvider

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

style
DateTimeStyles

A bitwise combination of the enumeration values that provides additional information about s, about style elements that may be present in s, or about the conversion from s to a DateOnly value. A typical value to specify is None.

Returns

An object that is equivalent to the date contained in s, as specified by format, provider, and style.

Exceptions

s does not contain a valid string representation of a date.

Applies to

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

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. The format of the string representation must match at least one of the specified formats exactly or an exception is thrown.

public static DateOnly ParseExact (ReadOnlySpan<char> s, string[] formats, IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None);
static member ParseExact : ReadOnlySpan<char> * string[] * IFormatProvider * System.Globalization.DateTimeStyles -> DateOnly
Public Shared Function ParseExact (s As ReadOnlySpan(Of Char), formats As String(), provider As IFormatProvider, Optional style As DateTimeStyles = System.Globalization.DateTimeStyles.None) As DateOnly

Parameters

s
ReadOnlySpan<Char>

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

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 indicates the permitted format of s. A typical value to specify is None.

Returns

An object that is equivalent to the date contained in s, as specified by format, provider, and style.

Applies to

ParseExact(ReadOnlySpan<Char>, String[])

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. The format of the string representation must match at least one of the specified formats exactly or an exception is thrown.

public:
 static DateOnly ParseExact(ReadOnlySpan<char> s, cli::array <System::String ^> ^ formats);
public static DateOnly ParseExact (ReadOnlySpan<char> s, string[] formats);
static member ParseExact : ReadOnlySpan<char> * string[] -> DateOnly
Public Shared Function ParseExact (s As ReadOnlySpan(Of Char), formats As String()) As DateOnly

Parameters

s
ReadOnlySpan<Char>

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

formats
String[]

An array of allowable formats of s.

Returns

An object that is equivalent to the date contained in s, as specified by format, provider, and style.

Exceptions

s does not contain a valid string representation of a date.

Applies to

ParseExact(String, String[])

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. The format of the string representation must match at least one of the specified formats exactly or an exception is thrown.

public:
 static DateOnly ParseExact(System::String ^ s, cli::array <System::String ^> ^ formats);
public static DateOnly ParseExact (string s, string[] formats);
static member ParseExact : string * string[] -> DateOnly
Public Shared Function ParseExact (s As String, formats As String()) As DateOnly

Parameters

s
String

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

formats
String[]

An array of allowable formats of s.

Returns

An object that is equivalent to the date contained in s, as specified by format, provider, and style.

Exceptions

s does not contain a valid string representation of a date.

Applies to

ParseExact(String, String)

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. The format of the string representation must match the specified format exactly or an exception is thrown.

public:
 static DateOnly ParseExact(System::String ^ s, System::String ^ format);
public static DateOnly ParseExact (string s, string format);
static member ParseExact : string * string -> DateOnly
Public Shared Function ParseExact (s As String, format As String) As DateOnly

Parameters

s
String

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

format
String

A string that represent a format specifier that defines the required format of s.

Returns

An object that is equivalent to the date contained in s, as specified by format.

Exceptions

s does not contain a valid string representation of a date.

Remarks

The ParseExact(String, String) method parses the string representation of a date, which must be in the format defined by the format parameter. It also requires that the <Date> element of the string representation of a date appear in the order specified by format, and that s have no white space other than that permitted by format. The format parameter is a string that contains either a single standard format specifier, or one or more custom format specifiers that define the required format of s. For details about valid formatting codes, see Standard Date and Time Format Strings or Custom Date and Time Format Strings.

Note

If format is a custom format pattern that does not include date separators (such as "yyyyMMdd"), use the widest form of each custom format specifier. For example, if you want to specify months in the format pattern, specify the wider form, "MM", instead of the narrower form, "M".

Applies to

ParseExact(ReadOnlySpan<Char>, ReadOnlySpan<Char>, IFormatProvider, DateTimeStyles)

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 or an exception is thrown.

public static DateOnly ParseExact (ReadOnlySpan<char> s, ReadOnlySpan<char> format, IFormatProvider? provider = default, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None);
static member ParseExact : ReadOnlySpan<char> * ReadOnlySpan<char> * IFormatProvider * System.Globalization.DateTimeStyles -> DateOnly
Public Shared Function ParseExact (s As ReadOnlySpan(Of Char), format As ReadOnlySpan(Of Char), Optional provider As IFormatProvider = Nothing, Optional style As DateTimeStyles = System.Globalization.DateTimeStyles.None) As DateOnly

Parameters

s
ReadOnlySpan<Char>

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

format
ReadOnlySpan<Char>

A span containing the characters that represent a format specifier that defines the required format of s.

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.

Returns

An object that is equivalent to the date contained in s, as specified by format, provider, and style.

Exceptions

s does not contain a valid string representation of a date.

Applies to