@Test public void testGetFullAge4LocalDateDetails() { int year = 2010; for (int m = 1; m <= 12; m++) { Assert.assertEquals(0, AgeUtils.getFullAge(LocalDate.of(year, 1, 1), LocalDate.of(year, m, 1))); } LocalDate toDate; int lastDay; for (int m = 1; m <= 12; m++) { toDate = LocalDate.of(year + 1, m, 1); lastDay = toDate.plusMonths(1).minusDays(1).getDayOfMonth(); for (int d = 1; d <= lastDay; d++) { Assert.assertEquals(1, AgeUtils.getFullAge(LocalDate.of(year, 1, 1), LocalDate.of(year + 1, m, d))); } } Assert.assertEquals(2, AgeUtils.getFullAge(LocalDate.of(year, 1, 1), LocalDate.of(year + 2, 1, 1))); Assert.assertEquals(2, AgeUtils.getFullAge(LocalDate.of(year, 2, 10), LocalDate.of(year + 2, 2, 10))); Assert.assertEquals(2, AgeUtils.getFullAge(LocalDate.of(year, 2, 10), LocalDate.of(year + 2, 12, 31))); Assert.assertEquals(1, AgeUtils.getFullAge(LocalDate.of(year, 2, 10), LocalDate.of(year + 2, 2, 9))); }
public static int getFullAge(Date birthDate) { return getFullAge(birthDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()); }
AgeUtils { public static int getFullAge(Date birthDate) { return getFullAge(birthDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()); } }
AgeUtils { public static int getFullAge(Date birthDate) { return getFullAge(birthDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()); }  }
AgeUtils { public static int getFullAge(Date birthDate) { return getFullAge(birthDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()); }  static int getFullAge(Date birthDate); static int getFullAge(Calendar birthDate); static int getFullAge(LocalDate birthDate); static int getFullAge(LocalDate fromDate, LocalDate toDate); static Period getAge(LocalDate birthDate); static Period getAge(LocalDate fromDate, LocalDate toDate); }
AgeUtils { public static int getFullAge(Date birthDate) { return getFullAge(birthDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()); }  static int getFullAge(Date birthDate); static int getFullAge(Calendar birthDate); static int getFullAge(LocalDate birthDate); static int getFullAge(LocalDate fromDate, LocalDate toDate); static Period getAge(LocalDate birthDate); static Period getAge(LocalDate fromDate, LocalDate toDate);  }