Bewerken

Delen via


TimeOnly.ParseExact Method

Definition

Overloads

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

Converts the specified string representation of a time to its TimeOnly 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 time to its TimeOnly 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 time to its TimeOnly 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>, ReadOnlySpan<Char>, IFormatProvider, DateTimeStyles)

Converts the specified span representation of a time to its TimeOnly 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[])

Converts the specified span to a TimeOnly 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 time to its TimeOnly 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>, String[])

Converts the specified span to its TimeOnly 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[], IFormatProvider, DateTimeStyles)

Source:
TimeOnly.cs
Source:
TimeOnly.cs
Source:
TimeOnly.cs

Converts the specified string representation of a time to its TimeOnly 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 TimeOnly ParseExact (string s, string[] formats, IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None);
static member ParseExact : string * string[] * IFormatProvider * System.Globalization.DateTimeStyles -> TimeOnly
Public Shared Function ParseExact (s As String, formats As String(), provider As IFormatProvider, Optional style As DateTimeStyles = System.Globalization.DateTimeStyles.None) As TimeOnly

Parameters

s
String

A string containing the time to convert.

formats
String[]

An array of allowable formats of s.

provider
IFormatProvider

The 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

A TimeOnly instance.

Exceptions

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

Applies to

ParseExact(String, String, IFormatProvider, DateTimeStyles)

Source:
TimeOnly.cs
Source:
TimeOnly.cs
Source:
TimeOnly.cs

Converts the specified string representation of a time to its TimeOnly 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 TimeOnly ParseExact (string s, string format, IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None);
static member ParseExact : string * string * IFormatProvider * System.Globalization.DateTimeStyles -> TimeOnly
Public Shared Function ParseExact (s As String, format As String, provider As IFormatProvider, Optional style As DateTimeStyles = System.Globalization.DateTimeStyles.None) As TimeOnly

Parameters

s
String

A string containing the time to convert.

format
String

The format specifier that defines the required format of s.

provider
IFormatProvider

The 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 TimeOnly value. A typical value to specify is None.

Returns

A TimeOnly instance.

Exceptions

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

Applies to

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

Source:
TimeOnly.cs
Source:
TimeOnly.cs
Source:
TimeOnly.cs

Converts the specified span representation of a time to its TimeOnly 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 TimeOnly 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 -> TimeOnly
Public Shared Function ParseExact (s As ReadOnlySpan(Of Char), formats As String(), provider As IFormatProvider, Optional style As DateTimeStyles = System.Globalization.DateTimeStyles.None) As TimeOnly

Parameters

s
ReadOnlySpan<Char>

A span containing the time to convert.

formats
String[]

An array of allowable formats of s.

provider
IFormatProvider

The 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

A TimeOnly instance.

Exceptions

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

Applies to

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

Source:
TimeOnly.cs
Source:
TimeOnly.cs
Source:
TimeOnly.cs

Converts the specified span representation of a time to its TimeOnly 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 TimeOnly 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 -> TimeOnly
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 TimeOnly

Parameters

s
ReadOnlySpan<Char>

A span containing the time to convert.

format
ReadOnlySpan<Char>

The format specifier that defines the required format of s.

provider
IFormatProvider

The 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

A TimeOnly instance.

Exceptions

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

Applies to

ParseExact(String, String[])

Source:
TimeOnly.cs
Source:
TimeOnly.cs
Source:
TimeOnly.cs

Converts the specified span to a TimeOnly 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 TimeOnly ParseExact(System::String ^ s, cli::array <System::String ^> ^ formats);
public static TimeOnly ParseExact (string s, string[] formats);
static member ParseExact : string * string[] -> TimeOnly
Public Shared Function ParseExact (s As String, formats As String()) As TimeOnly

Parameters

s
String

A span containing the time to convert.

formats
String[]

An array of allowable formats of s.

Returns

A TimeOnly instance.

Exceptions

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

Applies to

ParseExact(String, String)

Source:
TimeOnly.cs
Source:
TimeOnly.cs
Source:
TimeOnly.cs

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

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

Parameters

s
String

A string containing a time to convert.

format
String

A format specifier that defines the required format of s.

Returns

A TimeOnly instance.

Exceptions

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

Applies to

ParseExact(ReadOnlySpan<Char>, String[])

Source:
TimeOnly.cs
Source:
TimeOnly.cs
Source:
TimeOnly.cs

Converts the specified span to its TimeOnly 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 TimeOnly ParseExact(ReadOnlySpan<char> s, cli::array <System::String ^> ^ formats);
public static TimeOnly ParseExact (ReadOnlySpan<char> s, string[] formats);
static member ParseExact : ReadOnlySpan<char> * string[] -> TimeOnly
Public Shared Function ParseExact (s As ReadOnlySpan(Of Char), formats As String()) As TimeOnly

Parameters

s
ReadOnlySpan<Char>

A span containing the time to convert.

formats
String[]

An array of allowable formats of s.

Returns

A TimeOnly instance.

Exceptions

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

Applies to