public static YearMonth parse(String str, DateTimeFormatter formatter) {
        LocalDate date = formatter.parseLocalDate(str);
        return new YearMonth(date.getYear(), date.getMonthOfYear());
    }
public static YearMonth parse ( String str , DateTimeFormatter formatter ) { LocalDate date = formatter . parseLocalDate ( str ) ; return new YearMonth ( date . getYear ( ) , date . getMonthOfYear ( ) ) ; }
Parses a {@code YearMonth} from the specified string using a formatter.

@param str  the string to parse, not null
@param formatter  the formatter to use, not null
@since 2.0