/** * Converts this object to a LocalDate with the same year-month and chronology. * * @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO * @return a LocalDate with the same year-month and chronology, never null */ public LocalDate toLocalDate(int dayOfMonth) { return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology()); }
/** * Converts this object to a LocalDate with the same year-month and chronology. * * @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO * @return a LocalDate with the same year-month and chronology, never null */ public LocalDate toLocalDate(int dayOfMonth) { return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology()); }
/** * Converts this object to a LocalDate with the same year-month and chronology. * * @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO * @return a LocalDate with the same year-month and chronology, never null */ public LocalDate toLocalDate(int dayOfMonth) { return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology()); }
/** * Converts this object to a LocalDate with the same year-month and chronology. * * @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO * @return a LocalDate with the same year-month and chronology, never null */ public LocalDate toLocalDate(int dayOfMonth) { return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology()); }
/** * Converts this object to a LocalDate with the same year-month and chronology. * * @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO * @return a LocalDate with the same year-month and chronology, never null */ public LocalDate toLocalDate(int dayOfMonth) { return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology()); }
/** * Converts this object to a LocalDate with the same year-month and chronology. * * @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO * @return a LocalDate with the same year-month and chronology, never null */ public LocalDate toLocalDate(int dayOfMonth) { return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology()); }
/** * Converts this object to a LocalDate with the same year-month and chronology. * * @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO * @return a LocalDate with the same year-month and chronology, never null */ public LocalDate toLocalDate(int dayOfMonth) { return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology()); }
/** * Converts this object to a LocalDate with the same year-month and chronology. * * @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO * @return a LocalDate with the same year-month and chronology, never null */ public LocalDate toLocalDate(int dayOfMonth) { return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology()); }
private int getIntervalColumnsCount(Date intervalFrom, Date intervalTo) { YearMonth yearMonthStart = new YearMonth(intervalFrom.getTime()); YearMonth yearMonthEnd = new YearMonth(intervalTo.getTime()); int yearsDifference = yearMonthEnd.getYear() - yearMonthStart.getYear(); int monthsDifference = yearMonthEnd.getMonthOfYear() - yearMonthStart.getMonthOfYear(); return 1 + yearsDifference * 12 + monthsDifference; }
/** * Converts this object to a LocalDate with the same year-month and chronology. * * @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO * @return a LocalDate with the same year-month and chronology, never null */ public LocalDate toLocalDate(int dayOfMonth) { return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology()); }
/** * Converts this object to a LocalDate with the same year-month and chronology. * * @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO * @return a LocalDate with the same year-month and chronology, never null */ public LocalDate toLocalDate(int dayOfMonth) { return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology()); }
@Test(dataProvider = "string2ym") public void testString2Java8YearMonth(String s, YearMonth ym) throws Exception { String2Java8YearMonth convertor = new String2Java8YearMonth(); Assert.assertEquals(convertor.convert(s), java.time.YearMonth.of(ym.getYear(), ym.getMonthOfYear())); } }
private PersistableMonthItem getMonthItem(PersistablePublicationDownload download, PersistableAbstractReportItem<?> item) { YearMonth yearMonth = new YearMonth(download.getDownloadDate()); for (PersistableMonthItem monthItem : item.getMonthCounts()) { YearMonth itemYearMonth = new YearMonth(monthItem.getYear(), monthItem.getMonth()); if (itemYearMonth.equals(yearMonth)) { return monthItem; } } PersistableMonthItem monthItem = new PersistableMonthItem(); monthItem.setReportItem(item); monthItem.setMonth(yearMonth.getMonthOfYear()); monthItem.setYear(yearMonth.getYear()); item.getMonthCounts().add(monthItem); return monthItem; }