YearMonth.from

Obtains an instance of {@code YearMonth} from a temporal object. !(p) This obtains a year-month based on the specified temporal. A {@code TemporalAccessor} represents an arbitrary set of date and time information, which this factory converts to an instance of {@code YearMonth}. !(p) The conversion extracts the {@link ChronoField#YEAR YEAR} and {@link ChronoField#MONTH_OF_YEAR MONTH_OF_YEAR} fields. The extraction is only permitted if the temporal object has an ISO chronology, or can be converted to a {@code LocalDate}. !(p) This method matches the signature of the functional interface {@link TemporalQuery} allowing it to be used as a query via method reference, {@code YearMonth.from}.

@param temporal the temporal object to convert, not null @return the year-month, not null @throws DateTimeException if unable to convert to a {@code YearMonth}

class YearMonth
static
from

Meta