@Test public void testParseYearMonth() { String toParse = "2000-12"; LocalDate localDate = DateUtil.parseLocalDate(toParse); assertNotNull("Error parsing yyyy-MM", localDate); assertEquals(2000, localDate.getYear()); assertEquals(12, localDate.getMonthOfYear()); assertEquals(1, localDate.getDayOfMonth()); toParse = "2010-20"; assertNull("Error parsing yyyy-MM", DateUtil.parseLocalDate(toParse)); }
public static LocalDate parseLocalDate(String timestamp) { if (timestamp != null) { for (DateTimeFormatter formatter : DateUtil.formatters) { try { return formatter.parseLocalDate(timestamp); } catch (IllegalArgumentException e) { } } } return null; }
DateUtil { public static LocalDate parseLocalDate(String timestamp) { if (timestamp != null) { for (DateTimeFormatter formatter : DateUtil.formatters) { try { return formatter.parseLocalDate(timestamp); } catch (IllegalArgumentException e) { } } } return null; } }
DateUtil { public static LocalDate parseLocalDate(String timestamp) { if (timestamp != null) { for (DateTimeFormatter formatter : DateUtil.formatters) { try { return formatter.parseLocalDate(timestamp); } catch (IllegalArgumentException e) { } } } return null; } private  DateUtil(); }
DateUtil { public static LocalDate parseLocalDate(String timestamp) { if (timestamp != null) { for (DateTimeFormatter formatter : DateUtil.formatters) { try { return formatter.parseLocalDate(timestamp); } catch (IllegalArgumentException e) { } } } return null; } private  DateUtil(); static String formatYearMonthDayNoDash(Date date); static String formatYearMonthDayNoDash(LocalDate date); static String formatYearMonthDay(Date date); static String formatYearMonthDay(LocalDate date); static String formatYearMonth(Date date); static String formatYearMonth(LocalDate date); static String formatYearMonthNoDash(Date date); static String formatYearMonthNoDash(LocalDate date); static LocalDate parseLocalDate(String timestamp); static String lastMonthInYearMonthFormat(); static LocalDate firstDayPreviousMonth(); static LocalDate lastDayPreviousMonth(); static LocalDate firstDayMonth(LocalDate localDate); static LocalDate lastDayMonth(LocalDate localDate); }
DateUtil { public static LocalDate parseLocalDate(String timestamp) { if (timestamp != null) { for (DateTimeFormatter formatter : DateUtil.formatters) { try { return formatter.parseLocalDate(timestamp); } catch (IllegalArgumentException e) { } } } return null; } private  DateUtil(); static String formatYearMonthDayNoDash(Date date); static String formatYearMonthDayNoDash(LocalDate date); static String formatYearMonthDay(Date date); static String formatYearMonthDay(LocalDate date); static String formatYearMonth(Date date); static String formatYearMonth(LocalDate date); static String formatYearMonthNoDash(Date date); static String formatYearMonthNoDash(LocalDate date); static LocalDate parseLocalDate(String timestamp); static String lastMonthInYearMonthFormat(); static LocalDate firstDayPreviousMonth(); static LocalDate lastDayPreviousMonth(); static LocalDate firstDayMonth(LocalDate localDate); static LocalDate lastDayMonth(LocalDate localDate);  }