Java Code Examples for java.time.Month#DECEMBER

The following examples show how to use java.time.Month#DECEMBER . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TCKLocalDate.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private LocalDate next(LocalDate date) {
    int newDayOfMonth = date.getDayOfMonth() + 1;
    if (newDayOfMonth <= date.getMonth().length(isIsoLeap(date.getYear()))) {
        return date.withDayOfMonth(newDayOfMonth);
    }
    date = date.withDayOfMonth(1);
    if (date.getMonth() == Month.DECEMBER) {
        date = date.withYear(date.getYear() + 1);
    }
    return date.with(date.getMonth().plus(1));
}
 
Example 2
Source File: TCKLocalDate.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private LocalDate previous(LocalDate date) {
    int newDayOfMonth = date.getDayOfMonth() - 1;
    if (newDayOfMonth > 0) {
        return date.withDayOfMonth(newDayOfMonth);
    }
    date = date.with(date.getMonth().minus(1));
    if (date.getMonth() == Month.DECEMBER) {
        date = date.withYear(date.getYear() - 1);
    }
    return date.withDayOfMonth(date.getMonth().length(isIsoLeap(date.getYear())));
}
 
Example 3
Source File: TCKLocalDate.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private LocalDate next(LocalDate date) {
    int newDayOfMonth = date.getDayOfMonth() + 1;
    if (newDayOfMonth <= date.getMonth().length(isIsoLeap(date.getYear()))) {
        return date.withDayOfMonth(newDayOfMonth);
    }
    date = date.withDayOfMonth(1);
    if (date.getMonth() == Month.DECEMBER) {
        date = date.withYear(date.getYear() + 1);
    }
    return date.with(date.getMonth().plus(1));
}
 
Example 4
Source File: TCKLocalDate.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private LocalDate previous(LocalDate date) {
    int newDayOfMonth = date.getDayOfMonth() - 1;
    if (newDayOfMonth > 0) {
        return date.withDayOfMonth(newDayOfMonth);
    }
    date = date.with(date.getMonth().minus(1));
    if (date.getMonth() == Month.DECEMBER) {
        date = date.withYear(date.getYear() - 1);
    }
    return date.withDayOfMonth(date.getMonth().length(isIsoLeap(date.getYear())));
}
 
Example 5
Source File: TCKLocalDate.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private LocalDate next(LocalDate date) {
    int newDayOfMonth = date.getDayOfMonth() + 1;
    if (newDayOfMonth <= date.getMonth().length(isIsoLeap(date.getYear()))) {
        return date.withDayOfMonth(newDayOfMonth);
    }
    date = date.withDayOfMonth(1);
    if (date.getMonth() == Month.DECEMBER) {
        date = date.withYear(date.getYear() + 1);
    }
    return date.with(date.getMonth().plus(1));
}
 
Example 6
Source File: TestLocalDate.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private LocalDate next(LocalDate date) {
    int newDayOfMonth = date.getDayOfMonth() + 1;
    if (newDayOfMonth <= date.getMonth().length(isIsoLeap(date.getYear()))) {
        return date.withDayOfMonth(newDayOfMonth);
    }
    date = date.withDayOfMonth(1);
    if (date.getMonth() == Month.DECEMBER) {
        date = date.withYear(date.getYear() + 1);
    }
    return date.with(date.getMonth().plus(1));
}
 
Example 7
Source File: TestLocalDate.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private LocalDate previous(LocalDate date) {
    int newDayOfMonth = date.getDayOfMonth() - 1;
    if (newDayOfMonth > 0) {
        return date.withDayOfMonth(newDayOfMonth);
    }
    date = date.with(date.getMonth().minus(1));
    if (date.getMonth() == Month.DECEMBER) {
        date = date.withYear(date.getYear() - 1);
    }
    return date.withDayOfMonth(date.getMonth().length(isIsoLeap(date.getYear())));
}
 
Example 8
Source File: TCKLocalDate.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private LocalDate previous(LocalDate date) {
    int newDayOfMonth = date.getDayOfMonth() - 1;
    if (newDayOfMonth > 0) {
        return date.withDayOfMonth(newDayOfMonth);
    }
    date = date.with(date.getMonth().minus(1));
    if (date.getMonth() == Month.DECEMBER) {
        date = date.withYear(date.getYear() - 1);
    }
    return date.withDayOfMonth(date.getMonth().length(isIsoLeap(date.getYear())));
}
 
Example 9
Source File: StringConversionUnitTest.java    From tutorials with MIT License 5 votes vote down vote up
@Test
public void whenConvertedToLocalDateTime_thenCorrect() {
    String str = "2007-12-03T10:15:30";
    int afterConvCalendarDay = 03;
    Month afterConvCalendarMonth = Month.DECEMBER;
    int afterConvCalendarYear = 2007;
    LocalDateTime afterConvDate = new UseLocalDateTime().getLocalDateTimeUsingParseMethod(str);

    assertEquals(afterConvDate.getDayOfMonth(), afterConvCalendarDay);
    assertEquals(afterConvDate.getMonth(), afterConvCalendarMonth);
    assertEquals(afterConvDate.getYear(), afterConvCalendarYear);
}
 
Example 10
Source File: TCKLocalDate.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private LocalDate next(LocalDate date) {
    int newDayOfMonth = date.getDayOfMonth() + 1;
    if (newDayOfMonth <= date.getMonth().length(isIsoLeap(date.getYear()))) {
        return date.withDayOfMonth(newDayOfMonth);
    }
    date = date.withDayOfMonth(1);
    if (date.getMonth() == Month.DECEMBER) {
        date = date.withYear(date.getYear() + 1);
    }
    return date.with(date.getMonth().plus(1));
}
 
Example 11
Source File: TestLocalDate.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private LocalDate previous(LocalDate date) {
    int newDayOfMonth = date.getDayOfMonth() - 1;
    if (newDayOfMonth > 0) {
        return date.withDayOfMonth(newDayOfMonth);
    }
    date = date.with(date.getMonth().minus(1));
    if (date.getMonth() == Month.DECEMBER) {
        date = date.withYear(date.getYear() - 1);
    }
    return date.withDayOfMonth(date.getMonth().length(isIsoLeap(date.getYear())));
}
 
Example 12
Source File: TestLocalDate.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private LocalDate previous(LocalDate date) {
    int newDayOfMonth = date.getDayOfMonth() - 1;
    if (newDayOfMonth > 0) {
        return date.withDayOfMonth(newDayOfMonth);
    }
    date = date.with(date.getMonth().minus(1));
    if (date.getMonth() == Month.DECEMBER) {
        date = date.withYear(date.getYear() - 1);
    }
    return date.withDayOfMonth(date.getMonth().length(isIsoLeap(date.getYear())));
}
 
Example 13
Source File: TCKLocalDate.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private LocalDate previous(LocalDate date) {
    int newDayOfMonth = date.getDayOfMonth() - 1;
    if (newDayOfMonth > 0) {
        return date.withDayOfMonth(newDayOfMonth);
    }
    date = date.with(date.getMonth().minus(1));
    if (date.getMonth() == Month.DECEMBER) {
        date = date.withYear(date.getYear() - 1);
    }
    return date.withDayOfMonth(date.getMonth().length(isIsoLeap(date.getYear())));
}
 
Example 14
Source File: TestLocalDate.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private LocalDate next(LocalDate date) {
    int newDayOfMonth = date.getDayOfMonth() + 1;
    if (newDayOfMonth <= date.getMonth().length(isIsoLeap(date.getYear()))) {
        return date.withDayOfMonth(newDayOfMonth);
    }
    date = date.withDayOfMonth(1);
    if (date.getMonth() == Month.DECEMBER) {
        date = date.withYear(date.getYear() + 1);
    }
    return date.with(date.getMonth().plus(1));
}
 
Example 15
Source File: MergeBotFactory.java    From skara with GNU General Public License v2.0 5 votes vote down vote up
private static Month toMonth(String s) {
    switch (s.toLowerCase()) {
        case "january":
            return Month.JANUARY;
        case "february":
            return Month.FEBRUARY;
        case "march":
            return Month.MARCH;
        case "april":
            return Month.APRIL;
        case "may":
            return Month.MAY;
        case "june":
            return Month.JUNE;
        case "july":
            return Month.JULY;
        case "august":
            return Month.AUGUST;
        case "september":
            return Month.SEPTEMBER;
        case "october":
            return Month.OCTOBER;
        case "november":
            return Month.NOVEMBER;
        case "december":
            return Month.DECEMBER;
        default:
            throw new IllegalArgumentException("Unknown month: " + s);
    }
}
 
Example 16
Source File: TCKMonth.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected List<TemporalAccessor> samples() {
    TemporalAccessor[] array = {Month.JANUARY, Month.JUNE, Month.DECEMBER, };
    return Arrays.asList(array);
}
 
Example 17
Source File: PackedLocalDateTime.java    From tablesaw with Apache License 2.0 4 votes vote down vote up
public static boolean isInDecember(long packedDateTime) {
  return (packedDateTime != missingValueIndicator())
      && getMonth(packedDateTime) == Month.DECEMBER;
}
 
Example 18
Source File: TCKMonth.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected List<TemporalAccessor> samples() {
    TemporalAccessor[] array = {Month.JANUARY, Month.JUNE, Month.DECEMBER, };
    return Arrays.asList(array);
}
 
Example 19
Source File: TCKMonth.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected List<TemporalAccessor> samples() {
    TemporalAccessor[] array = {Month.JANUARY, Month.JUNE, Month.DECEMBER, };
    return Arrays.asList(array);
}
 
Example 20
Source File: TCKMonth.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected List<TemporalAccessor> samples() {
    TemporalAccessor[] array = {Month.JANUARY, Month.JUNE, Month.DECEMBER, };
    return Arrays.asList(array);
}