Language

YearMonth.Parse Method

Definition

Overloads

Name Description
Parse(String, DateTimeFormatter)

Parses a year-month string with the specified formatter.

Parse(ICharSequence)

Obtains an instance of YearMonth from a text string such as 2007-12.

Parse(String)

Parses an ISO year and month from a string.

Parse(ICharSequence, DateTimeFormatter)

Obtains an instance of YearMonth from a text string using a specific formatter.

Parse(String, DateTimeFormatter)

Parses a year-month string with the specified formatter.

public static Java.Time.YearMonth? Parse(string? text, Java.Time.Format.DateTimeFormatter? formatter);
static member Parse : string * Java.Time.Format.DateTimeFormatter -> Java.Time.YearMonth

Parameters

text
String

The string that contains the year and month fields.

formatter
DateTimeFormatter

The formatter that reads the year and month fields.

Returns

The year and month read from text.

Remarks

This string overload calls Parse(ICharSequence, DateTimeFormatter). The supplied formatter determines the input format.

Applies to

Parse(ICharSequence)

Obtains an instance of YearMonth from a text string such as 2007-12.

[Android.Runtime.Register("parse", "(Ljava/lang/CharSequence;)Ljava/time/YearMonth;", "", ApiSince=26)]
public static Java.Time.YearMonth? Parse(Java.Lang.ICharSequence? text);
[<Android.Runtime.Register("parse", "(Ljava/lang/CharSequence;)Ljava/time/YearMonth;", "", ApiSince=26)>]
static member Parse : Java.Lang.ICharSequence -> Java.Time.YearMonth

Parameters

text
ICharSequence

the text to parse such as "2007-12", not null

Returns

the parsed year-month, not null

Attributes

Remarks

Obtains an instance of YearMonth from a text string such as 2007-12. The string must represent a valid year-month. The format must be uuuu-MM. Years outside the range 0000 to 9999 must be prefixed by the plus or minus symbol.

Java reference for java.time.YearMonth.parse.

Applies to

Parse(String)

Parses an ISO year and month from a string.

public static Java.Time.YearMonth? Parse(string? text);
static member Parse : string -> Java.Time.YearMonth

Parameters

text
String

The year and month text, for example 2007-12.

Returns

The year and month read from text.

Remarks

This string overload calls Parse(ICharSequence). Its default format separates the year and two-digit month with a hyphen.

Applies to

Parse(ICharSequence, DateTimeFormatter)

Obtains an instance of YearMonth from a text string using a specific formatter.

[Android.Runtime.Register("parse", "(Ljava/lang/CharSequence;Ljava/time/format/DateTimeFormatter;)Ljava/time/YearMonth;", "", ApiSince=26)]
public static Java.Time.YearMonth? Parse(Java.Lang.ICharSequence? text, Java.Time.Format.DateTimeFormatter? formatter);
[<Android.Runtime.Register("parse", "(Ljava/lang/CharSequence;Ljava/time/format/DateTimeFormatter;)Ljava/time/YearMonth;", "", ApiSince=26)>]
static member Parse : Java.Lang.ICharSequence * Java.Time.Format.DateTimeFormatter -> Java.Time.YearMonth

Parameters

text
ICharSequence

the text to parse, not null

formatter
DateTimeFormatter

the formatter to use, not null

Returns

the parsed year-month, not null

Attributes

Remarks

Obtains an instance of YearMonth from a text string using a specific formatter. The text is parsed using the formatter, returning a year-month.

Java reference for java.time.YearMonth.parse.

Applies to