Java Code Examples for java.time.Month#JANUARY

The following examples show how to use java.time.Month#JANUARY . 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: StringColumnMonthMapper.java    From jadira with Apache License 2.0 6 votes vote down vote up
@Override
public Month fromNonNullValue(String s) {
	
	switch(s) {
		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("Seen unexpected Month: " + s);
	}
}
 
Example 2
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 3
Source File: ZonedDateTimeAxis.java    From constellation with Apache License 2.0 5 votes vote down vote up
@Override
protected String getTickMarkLabel(ZonedDateTime datetime) {
    final StringConverter<ZonedDateTime> converter = getTickLabelFormatter();
    if (converter != null) {
        return converter.toString(datetime);
    }

    final DateTimeFormatter formatter;
    if (actualInterval.interval == ChronoUnit.YEARS && datetime.getMonth() == Month.JANUARY && datetime.getDayOfMonth() == 1) {
        formatter = DateTimeFormatter.ofPattern("yyyy");
    } else if (actualInterval.interval == ChronoUnit.MONTHS && datetime.getDayOfMonth() == 1) {
        formatter = DateTimeFormatter.ofPattern("MMM yy");
    } else {
        switch (actualInterval.interval) {
            case DAYS:
            case WEEKS:
            case HOURS:
            case MINUTES:
                formatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT);
                break;
            case SECONDS:
                formatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM);
                break;
            case MILLIS:
                formatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.FULL);
                break;
            default:
                formatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM);
                break;
        }
    }
    return formatter.format(datetime);
}
 
Example 4
Source File: PackedLocalDateTime.java    From tablesaw with Apache License 2.0 4 votes vote down vote up
public static boolean isInQ1(long packedDateTime) {
  if (packedDateTime == missingValueIndicator()) return false;
  Month month = getMonth(packedDateTime);
  return month == Month.JANUARY || month == Month.FEBRUARY || month == Month.MARCH;
}
 
Example 5
Source File: TCKMonth.java    From jdk8u-dev-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 6
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 7
Source File: PackedLocalDateTime.java    From tablesaw with Apache License 2.0 4 votes vote down vote up
public static boolean isInJanuary(long packedDateTime) {
  return (packedDateTime != missingValueIndicator()) && getMonth(packedDateTime) == Month.JANUARY;
}
 
Example 8
Source File: CalculateMinimumDateFieldSize.java    From LGoodDatePicker with MIT License 4 votes vote down vote up
/**
 * getLongestTextMonthInLocale,
 *
 * For the supplied locale, this returns the month that has the longest translated, "formatting
 * version", "long text version" month name. The version of the month name string that is used
 * for comparison is further defined below.
 *
 * Note that this does not return the longest month for numeric month date formats. The longest
 * month in entirely numeric formats is always December. (Month number 12).
 *
 * The compared month names are the "formatting version" of the translated month names (not the
 * standalone version). In some locales such as Russian and Czech, the formatting version can be
 * different from the standalone version. The "formatting version" is the name of the month that
 * would be used in a formatted date. The standalone version is only used when the month is
 * displayed by itself.
 *
 * The month names that are used for comparison are also the "long version" of the month names,
 * not the short (abbreviated) version.
 *
 * The translated month names are compared using the supplied font metrics.
 *
 * This returns the longest month, as defined by the above criteria. If two or more months are
 * "tied" as the "longest month", then the longest month that is closest to the end of the year
 * will be the one that is returned.
 */
static private Month getLongestTextMonthInLocale(Locale locale, FontMetrics fontMetrics) {
    // Get the "formatting names" of all the months for this locale.
    // Request the capitalized long version of the translated month names.
    String[] formattingMonthNames = ExtraDateStrings.getFormattingMonthNamesArray(
            locale, true, false);
    // Find out which month is longest, using the supplied font metrics.
    int longestMonthWidth = 0;
    Month longestMonth = Month.JANUARY;
    for (int i = 0; i < formattingMonthNames.length; ++i) {
        int currentMonthWidth = fontMetrics.stringWidth(formattingMonthNames[i]);
        if (currentMonthWidth >= longestMonthWidth) {
            int oneBasedMonthIndex = (i + 1);
            longestMonth = Month.of(oneBasedMonthIndex);
            longestMonthWidth = currentMonthWidth;
        }
    }
    return longestMonth;
}
 
Example 9
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 10
Source File: TCKMonth.java    From openjdk-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 11
Source File: PackedLocalDateTime.java    From tablesaw with Apache License 2.0 4 votes vote down vote up
public static boolean isInJanuary(long packedDateTime) {
  return (packedDateTime != missingValueIndicator()) && getMonth(packedDateTime) == Month.JANUARY;
}
 
Example 12
Source File: TCKMonth.java    From hottub 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 13
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 14
Source File: XMLFormatterDate.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
boolean isJanuaryFirst() {
    return zdt.getMonth() == Month.JANUARY && zdt.getDayOfMonth() == 1;
}
 
Example 15
Source File: TCKMonth.java    From openjdk-jdk9 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 16
Source File: TCKMonth.java    From openjdk-jdk8u-backup 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: 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);
}
 
Example 18
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 19
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 20
Source File: TCKMonth.java    From j2objc with Apache License 2.0 4 votes vote down vote up
@Override
protected List<TemporalAccessor> samples() {
    TemporalAccessor[] array = {Month.JANUARY, Month.JUNE, Month.DECEMBER, };
    return Arrays.asList(array);
}