Ler em inglês Editar

Compartilhar via


TimeOnly.Parse Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

Parse(String)

Converts the string representation of a time to its TimeOnly equivalent by using the conventions of the current culture.

Parse(ReadOnlySpan<Char>, IFormatProvider)

Parses a span of characters into a value.

Parse(String, IFormatProvider)

Parses a string into a value.

Parse(ReadOnlySpan<Char>, IFormatProvider, DateTimeStyles)

Converts a memory span that contains string representation of a time to its TimeOnly equivalent by using culture-specific format information and a formatting style.

Parse(String, IFormatProvider, DateTimeStyles)

Converts the string representation of a time to its TimeOnly equivalent by using culture-specific format information and a formatting style.

Parse(String)

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

Converts the string representation of a time to its TimeOnly equivalent by using the conventions of the current culture.

public static TimeOnly Parse(string s);

Parameters

s
String

The string to parse.

Returns

A TimeOnly instance.

Exceptions

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

Applies to

.NET 10 e outras versões
Produto Versões
.NET 6, 7, 8, 9, 10

Parse(ReadOnlySpan<Char>, IFormatProvider)

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

Parses a span of characters into a value.

public static TimeOnly Parse(ReadOnlySpan<char> s, IFormatProvider? provider);

Parameters

s
ReadOnlySpan<Char>

A span of characters to parse.

provider
IFormatProvider

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

Returns

The result of parsing s.

Implements

Applies to

.NET 10 e outras versões
Produto Versões
.NET 7, 8, 9, 10

Parse(String, IFormatProvider)

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

Parses a string into a value.

public static TimeOnly Parse(string s, IFormatProvider? provider);

Parameters

s
String

The string to parse.

provider
IFormatProvider

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

Returns

The result of parsing s.

Implements

Applies to

.NET 10 e outras versões
Produto Versões
.NET 7, 8, 9, 10

Parse(ReadOnlySpan<Char>, IFormatProvider, DateTimeStyles)

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

Converts a memory span that contains string representation of a time to its TimeOnly equivalent by using culture-specific format information and a formatting style.

public static TimeOnly Parse(ReadOnlySpan<char> s, IFormatProvider? provider = default, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None);

Parameters

s
ReadOnlySpan<Char>

The memory span that contains the time to parse.

provider
IFormatProvider

The culture-specific format 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

.NET 10 e outras versões
Produto Versões
.NET 6, 7, 8, 9, 10

Parse(String, IFormatProvider, DateTimeStyles)

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

Converts the string representation of a time to its TimeOnly equivalent by using culture-specific format information and a formatting style.

public static TimeOnly Parse(string s, IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None);

Parameters

s
String

The string containing the time to parse.

provider
IFormatProvider

The culture-specific format information about s.

style
DateTimeStyles

A bitwise combination of the enumeration values that indicates the style elements that can be present in s for the parse operation to succeed, and that defines how to interpret the parsed date. A typical value to specify is None.

Returns

ATimeOnly instance.

Exceptions

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

Applies to

.NET 10 e outras versões
Produto Versões
.NET 6, 7, 8, 9, 10