MonthDay from(TemporalAccessor temporal) example
Description
MonthDay from(TemporalAccessor temporal)
creates
an instance of MonthDay from a temporal object.
The conversion extracts the MONTH_OF_YEAR
and DAY_OF_MONTH
fields.
Syntax
from
has the following syntax.
public static MonthDay from(TemporalAccessor temporal)
Example
The following example shows how to use from
.
import java.time.LocalDate;
import java.time.MonthDay;
/*w w w .ja va 2 s . co m*/
public class Main {
public static void main(String[] args) {
MonthDay m = MonthDay.from(LocalDate.now());
System.out.println(m);
}
}
The code above generates the following result.