List of usage examples for java.time LocalDate of
public static LocalDate of(int year, int month, int dayOfMonth)
From source file:Main.java
public static String getMonthName(Integer month) { LocalDate localDate = LocalDate.of(0, month, 0); return localDate.getMonth().name(); }
From source file:Main.java
public static String getMonthName(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date);//from w w w. ja va 2s . c o m LocalDate localDate = LocalDate.of(0, cal.get(Calendar.MONTH) + 1, 1); return localDate.getMonth().name(); }
From source file:Main.java
public static List<Employee> persons() { Employee p1 = new Employee(1, "Jake", Gender.MALE, LocalDate.of(1971, Month.JANUARY, 1), 2343); Employee p2 = new Employee(2, "Jack", Gender.MALE, LocalDate.of(1972, Month.JULY, 21), 7100); Employee p3 = new Employee(3, "Jane", Gender.FEMALE, LocalDate.of(1973, Month.MAY, 29), 5455); Employee p4 = new Employee(4, "Jode", Gender.MALE, LocalDate.of(1974, Month.OCTOBER, 16), 1800); Employee p5 = new Employee(5, "Jeny", Gender.FEMALE, LocalDate.of(1975, Month.DECEMBER, 13), 1234); Employee p6 = new Employee(6, "Jason", Gender.MALE, LocalDate.of(1976, Month.JUNE, 9), 3211); List<Employee> persons = Arrays.asList(p1, p2, p3, p4, p5, p6); return persons; }
From source file:Main.java
public static List<Employee> persons() { Employee p1 = new Employee(1, "Jake", Gender.MALE, LocalDate.of(1971, Month.JANUARY, 1), 2343.0); Employee p2 = new Employee(2, "Jack", Gender.MALE, LocalDate.of(1972, Month.JULY, 21), 7100.0); Employee p3 = new Employee(3, "Jane", Gender.FEMALE, LocalDate.of(1973, Month.MAY, 29), 5455.0); Employee p4 = new Employee(4, "Jode", Gender.MALE, LocalDate.of(1974, Month.OCTOBER, 16), 1800.0); Employee p5 = new Employee(5, "Jeny", Gender.FEMALE, LocalDate.of(1975, Month.DECEMBER, 13), 1234.0); Employee p6 = new Employee(6, "Jason", Gender.MALE, LocalDate.of(1976, Month.JUNE, 9), 3211.0); List<Employee> persons = Arrays.asList(p1, p2, p3, p4, p5, p6); return persons; }
From source file:Main.java
public static List<Employee> persons() { Employee p1 = new Employee(1, "Jake", Gender.MALE, LocalDate.of(1971, Month.JANUARY, 1), 2343.0); Employee p2 = new Employee(2, "Jack", Gender.MALE, LocalDate.of(1972, Month.JULY, 21), 7100.0); Employee p3 = new Employee(3, "Jane", Gender.FEMALE, LocalDate.of(1973, Month.MAY, 29), 5455.0); Employee p4 = new Employee(4, "Jode", Gender.MALE, LocalDate.of(1974, Month.OCTOBER, 16), 1800.0); Employee p5 = new Employee(5, "Jeny", Gender.FEMALE, LocalDate.of(1975, Month.DECEMBER, 13), 1234.0); Employee p6 = new Employee(6, "Jason", Gender.MALE, LocalDate.of(1976, Month.JUNE, 9), 3211.0); List<Employee> persons = Arrays.asList(p1, p2, p3, p4, p5, p6); return persons; }
From source file:Main.java
public static List<Employee> persons() { Employee ken = new Employee(1, "Jame", Gender.MALE, LocalDate.of(1970, Month.MAY, 4), 6123.0); Employee jeff = new Employee(2, "Jeff", Gender.MALE, LocalDate.of(1971, Month.JULY, 5), 7112.0); Employee donna = new Employee(3, "Jane", Gender.FEMALE, LocalDate.of(1972, Month.JULY, 9), 8712.0); Employee chris = new Employee(4, "Jodd", Gender.MALE, LocalDate.of(1973, Month.DECEMBER, 6), 1823.0); Employee laynie = new Employee(5, "Janey", Gender.FEMALE, LocalDate.of(1974, Month.DECEMBER, 3), 1234.0); Employee lee = new Employee(6, "Jason", Gender.MALE, LocalDate.of(1975, Month.MAY, 8), 2412.0); // Create a list of persons List<Employee> persons = Arrays.asList(ken, jeff, donna, chris, laynie, lee); return persons; }
From source file:com.clearprecision.microservices.reference.jetty.service.BirthdayService.java
public Birthday getNumberOfDaysUntilBirthday(Integer day, Integer month) { Birthday bd = new Birthday(); LocalDate date = LocalDate.now(); LocalDate birthday = LocalDate.of(date.getYear(), month, day); long days = date.until(birthday, ChronoUnit.DAYS); bd.setDate(days + " days until your birthday"); return bd;/* w w w .ja v a 2 s .c om*/ }
From source file:Main.java
private LocalDate getMartinLutherKingDayForDateInYear(int year) { return LocalDate.of(year, Month.JANUARY, 1).with(TemporalAdjusters.dayOfWeekInMonth(3, DayOfWeek.MONDAY)); }
From source file:org.dozer.converters.LocalDateConverter.java
@Override public Object convert(Class destClass, Object srcObj) { LocalDate convertedValue = null; try {/*from w w w . j a va 2 s . c om*/ if (srcObj instanceof String) { convertedValue = LocalDate.parse((String) srcObj); } else { LocalDate srcObject = (LocalDate) srcObj; convertedValue = LocalDate.of(srcObject.getYear(), srcObject.getMonth(), srcObject.getDayOfMonth()); } } catch (Exception e) { MappingUtils.throwMappingException("Cannot convert [" + srcObj + "] to LocalDate.", e); } return convertedValue; }
From source file:fi.luontola.cqrshotel.JsonSerializationTest.java
@Test public void LocalDate_format() throws JsonProcessingException { assertThat(objectMapper.writeValueAsString(LocalDate.of(2000, 1, 2)), is("\"2000-01-02\"")); }