DateOnly.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 a string that contains string representation of a date to its DateOnly 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 date to its DateOnly equivalent by using culture-specific format information and a formatting style. |
Parse(String, IFormatProvider, DateTimeStyles) |
Converts a string that contains string representation of a date to its DateOnly equivalent by using culture-specific format information and a formatting style. |
Parse(String)
- Source:
- DateOnly.cs
- Source:
- DateOnly.cs
- Source:
- DateOnly.cs
Converts a string that contains string representation of a date to its DateOnly equivalent by using the conventions of the current culture.
public:
static DateOnly Parse(System::String ^ s);
public static DateOnly Parse (string s);
static member Parse : string -> DateOnly
Public Shared Function Parse (s As String) As DateOnly
Parameters
- s
- String
The string that contains the string to parse.
Returns
An object that is equivalent to the date contained in s
.
Exceptions
s
is null
.
s
does not contain a valid string representation of a date.
Applies to
Parse(ReadOnlySpan<Char>, IFormatProvider)
- Source:
- DateOnly.cs
- Source:
- DateOnly.cs
- Source:
- DateOnly.cs
Parses a span of characters into a value.
public:
static DateOnly Parse(ReadOnlySpan<char> s, IFormatProvider ^ provider) = ISpanParsable<DateOnly>::Parse;
public static DateOnly Parse (ReadOnlySpan<char> s, IFormatProvider? provider);
static member Parse : ReadOnlySpan<char> * IFormatProvider -> DateOnly
Public Shared Function Parse (s As ReadOnlySpan(Of Char), provider As IFormatProvider) As DateOnly
Parameters
- s
- ReadOnlySpan<Char>
The 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
Parse(String, IFormatProvider)
- Source:
- DateOnly.cs
- Source:
- DateOnly.cs
- Source:
- DateOnly.cs
Parses a string into a value.
public:
static DateOnly Parse(System::String ^ s, IFormatProvider ^ provider) = IParsable<DateOnly>::Parse;
public static DateOnly Parse (string s, IFormatProvider? provider);
static member Parse : string * IFormatProvider -> DateOnly
Public Shared Function Parse (s As String, provider As IFormatProvider) As DateOnly
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
Parse(ReadOnlySpan<Char>, IFormatProvider, DateTimeStyles)
- Source:
- DateOnly.cs
- Source:
- DateOnly.cs
- Source:
- DateOnly.cs
Converts a memory span that contains string representation of a date to its DateOnly equivalent by using culture-specific format information and a formatting style.
public static DateOnly Parse (ReadOnlySpan<char> s, IFormatProvider? provider = default, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None);
static member Parse : ReadOnlySpan<char> * IFormatProvider * System.Globalization.DateTimeStyles -> DateOnly
Public Shared Function Parse (s As ReadOnlySpan(Of Char), Optional provider As IFormatProvider = Nothing, Optional style As DateTimeStyles = System.Globalization.DateTimeStyles.None) As DateOnly
Parameters
- s
- ReadOnlySpan<Char>
The memory span that contains the string to parse.
- provider
- IFormatProvider
An object that supplies 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
An object that is equivalent to the date contained in s
, as specified by provider and styles.
Exceptions
s
does not contain a valid string representation of a date.
Applies to
Parse(String, IFormatProvider, DateTimeStyles)
- Source:
- DateOnly.cs
- Source:
- DateOnly.cs
- Source:
- DateOnly.cs
Converts a string that contains string representation of a date to its DateOnly equivalent by using culture-specific format information and a formatting style.
public static DateOnly Parse (string s, IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None);
static member Parse : string * IFormatProvider * System.Globalization.DateTimeStyles -> DateOnly
Public Shared Function Parse (s As String, provider As IFormatProvider, Optional style As DateTimeStyles = System.Globalization.DateTimeStyles.None) As DateOnly
Parameters
- s
- String
The string that contains the string to parse.
- provider
- IFormatProvider
An object that supplies 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
An object that is equivalent to the date contained in s
, as specified by provider and styles.
Exceptions
s
is null
.
s
does not contain a valid string representation of a date.