YearMonth parse(CharSequence text)
create
an instance of YearMonth from a text string such as 2014-12.
parse
has the following syntax.
public static YearMonth parse(CharSequence text)
The following example shows how to use parse
.
import java.time.YearMonth; //from w w w . j a v a2 s. co 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.