MonthDay
Description
A MonthDay represents a valid combination of a month and a day of month, for example, 12-15.
Example
The following code shows how to create MonthDay objects and perform basic operations on them.
import java.time.Month;
import java.time.MonthDay;
// ww w .java2 s . c om
public class Main {
public static void main(String[] args) {
MonthDay md1 = MonthDay.of(Month.DECEMBER, 25);
MonthDay md2 = MonthDay.of(Month.FEBRUARY, 29);
if (md2.isValidYear(2014)) {
System.out.println(md2);
}
System.out.println(md1.getDayOfMonth());
}
}
The code above generates the following result.