public static void main(String... args) { DateTimeFormatter f = DateTimeFormatter.ofPattern("MMM-uuuu"); String text = "Jun-2017"; YearMonth ym = YearMonth.parse(text, f);
YearMonth now = YearMonth.now(); System.out.println(now); int i = ym.compareTo(now); System.out.printf("Is %s current month of year = %s%n", text, i == 0); } }