Прочетете на английски Редактиране

Споделяне чрез


TimeOnly.Parse Method

Definition

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.

C#
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 и други версии
Продукт Версии
.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.

C#
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 и други версии
Продукт Версии
.NET 7, 8, 9, 10

Parse(String, IFormatProvider)

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

Parses a string into a value.

C#
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 и други версии
Продукт Версии
.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.

C#
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 и други версии
Продукт Версии
.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.

C#
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 и други версии
Продукт Версии
.NET 6, 7, 8, 9, 10