YearMonth parse(CharSequence text) example
Description
YearMonth parse(CharSequence text)
create
an instance of YearMonth from a text string such as 2014-12.
Syntax
parse
has the following syntax.
public static YearMonth parse(CharSequence text)
Example
The following example shows how to use parse
.
import java.time.YearMonth;
//w ww. j a v a 2 s. c o m
public class Main {
public static void main(String[] args) {
YearMonth y = YearMonth.parse("2013-09");
System.out.println(y);
}
}
The code above generates the following result.