Year.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
| Name | Description |
|---|---|
| Parse(String, DateTimeFormatter) |
Parses a year string with the specified formatter. |
| Parse(ICharSequence, DateTimeFormatter) |
Obtains an instance of Year from a text string using a specific formatter. |
| Parse(String) |
Parses an ISO calendar year from a string. |
| Parse(ICharSequence) |
Obtains an instance of Year from a text string such as 2007. |
Parse(String, DateTimeFormatter)
Parses a year string with the specified formatter.
public static Java.Time.Year? Parse(string? text, Java.Time.Format.DateTimeFormatter? formatter);
static member Parse : string * Java.Time.Format.DateTimeFormatter -> Java.Time.Year
Parameters
- text
- String
The string that contains the year field.
- formatter
- DateTimeFormatter
The formatter that reads the year field.
Returns
The year read from text.
Remarks
This string overload calls Parse(ICharSequence, DateTimeFormatter). The supplied formatter determines the input format.
Applies to
Parse(ICharSequence, DateTimeFormatter)
Obtains an instance of Year from a text string using a specific formatter.
[Android.Runtime.Register("parse", "(Ljava/lang/CharSequence;Ljava/time/format/DateTimeFormatter;)Ljava/time/Year;", "", ApiSince=26)]
public static Java.Time.Year? Parse(Java.Lang.ICharSequence? text, Java.Time.Format.DateTimeFormatter? formatter);
[<Android.Runtime.Register("parse", "(Ljava/lang/CharSequence;Ljava/time/format/DateTimeFormatter;)Ljava/time/Year;", "", ApiSince=26)>]
static member Parse : Java.Lang.ICharSequence * Java.Time.Format.DateTimeFormatter -> Java.Time.Year
Parameters
- text
- ICharSequence
the text to parse, not null
- formatter
- DateTimeFormatter
the formatter to use, not null
Returns
the parsed year, not null
- Attributes
Remarks
Obtains an instance of Year from a text string using a specific formatter. The text is parsed using the formatter, returning a year.
Java reference for java.time.Year.parse.
Applies to
Parse(String)
Parses an ISO calendar year from a string.
public static Java.Time.Year? Parse(string? text);
static member Parse : string -> Java.Time.Year
Parameters
- text
- String
The year text, for example 2007.
Returns
The year read from text.
Remarks
This string overload calls Parse(ICharSequence). Its default parser reads the ISO year field, including a minus sign for negative years.
Applies to
Parse(ICharSequence)
Obtains an instance of Year from a text string such as 2007.
[Android.Runtime.Register("parse", "(Ljava/lang/CharSequence;)Ljava/time/Year;", "", ApiSince=26)]
public static Java.Time.Year? Parse(Java.Lang.ICharSequence? text);
[<Android.Runtime.Register("parse", "(Ljava/lang/CharSequence;)Ljava/time/Year;", "", ApiSince=26)>]
static member Parse : Java.Lang.ICharSequence -> Java.Time.Year
Parameters
- text
- ICharSequence
the text to parse such as "2007", not null
Returns
the parsed year, not null
- Attributes
Remarks
Obtains an instance of Year from a text string such as 2007. The string must represent a valid year.
Java reference for java.time.Year.parse.