@Override public DateTimeFieldType[] getDateTimeFields() { return new DateTimeFieldType[] { DateTimeFieldType.monthOfYear() }; } private static final long serialVersionUID = 1;
/** * Instructs the printer to emit a numeric monthOfYear field. * * @param minDigits minimum number of digits to print * @return this DateTimeFormatterBuilder, for chaining */ public DateTimeFormatterBuilder appendMonthOfYear(int minDigits) { return appendDecimal(DateTimeFieldType.monthOfYear(), minDigits, 2); }
/** * Instructs the printer to emit a short locale-specific monthOfYear * text. The parser will accept a long or short monthOfYear text, * case-insensitive. * * @return this DateTimeFormatterBuilder, for chaining */ public DateTimeFormatterBuilder appendMonthOfYearText() { return appendText(DateTimeFieldType.monthOfYear()); }
public int monthOfYearTextToValue(String text) { Integer month = iParseMonths.get(text); if (month != null) { return month.intValue(); } throw new IllegalFieldValueException(DateTimeFieldType.monthOfYear(), text); }
/** * Instructs the printer to emit a locale-specific monthOfYear text. The * parser will accept a long or short monthOfYear text, case-insensitive. * * @return this DateTimeFormatterBuilder, for chaining */ public DateTimeFormatterBuilder appendMonthOfYearShortText() { return appendShortText(DateTimeFieldType.monthOfYear()); }
public int monthOfYearTextToValue(String text) { Integer month = iParseMonths.get(text); if (month != null) { return month.intValue(); } throw new IllegalFieldValueException(DateTimeFieldType.monthOfYear(), text); }
/** * Output the month-day in ISO8601 format (--MM-dd). * * @return ISO8601 time formatted string. */ @ToString public String toString() { List<DateTimeFieldType> fields = new ArrayList<DateTimeFieldType>(); fields.add(DateTimeFieldType.monthOfYear()); fields.add(DateTimeFieldType.dayOfMonth()); return ISODateTimeFormat.forFields(fields, true, true).print(this); }
protected void appendMonthOfYearShortText() { builder.appendMonthOfYearShortText(); appendTextField(DateTimeFieldType.monthOfYear(), true); } protected void appendMonthOfYearText() {
protected void appendMonthOfYear(int digits) { builder.appendMonthOfYear(digits); appendNumericField(DateTimeFieldType.monthOfYear(), digits); } protected void appendMonthOfYearShortText() {
/** * Get the month of year field for this chronology. * * @return DateTimeField or UnsupportedDateTimeField if unsupported */ public DateTimeField monthOfYear() { return UnsupportedDateTimeField.getInstance(DateTimeFieldType.monthOfYear(), months()); }
/** * Restricted constructor. * * @param leapMonth the month of year that leaps */ BasicMonthOfYearDateTimeField(BasicChronology chronology, int leapMonth) { super(DateTimeFieldType.monthOfYear(), chronology.getAverageMillisPerMonth()); iChronology = chronology; iMax = iChronology.getMaxMonth(); iLeapMonth = leapMonth; }
protected void appendMonthOfYearText() { builder.appendMonthOfYearText(); appendTextField(DateTimeFieldType.monthOfYear(), false); }
/** * Restricted constructor. * * @param leapMonth the month of year that leaps */ BasicMonthOfYearDateTimeField(BasicChronology chronology, int leapMonth) { super(DateTimeFieldType.monthOfYear(), chronology.getAverageMillisPerMonth()); iChronology = chronology; iMax = iChronology.getMaxMonth(); iLeapMonth = leapMonth; }
public int getMaximumValue(ReadablePartial partial) { if (partial.isSupported(DateTimeFieldType.monthOfYear())) { int month = partial.get(DateTimeFieldType.monthOfYear()); if (partial.isSupported(DateTimeFieldType.year())) { int year = partial.get(DateTimeFieldType.year()); return iChronology.getDaysInYearMonth(year, month); } return iChronology.getDaysInMonthMax(month); } return getMaximumValue(); }
protected static boolean hasYYYYMMDD(ReadablePartial base) { if (base == null) { return false; } else { return base.isSupported(DateTimeFieldType.year()) && base.isSupported(DateTimeFieldType.monthOfYear()) && base.isSupported(DateTimeFieldType.dayOfMonth()); } }
protected static boolean hasYYMMDD(ReadablePartial base) { if (base == null) { return false; } else { return base.isSupported(DateTimeFieldType.yearOfCentury()) && base.isSupported(DateTimeFieldType.monthOfYear()) && base.isSupported(DateTimeFieldType.dayOfMonth()); } }
private static DateTimeFormatter basicDate() { if (bd == null) { return new DateTimeFormatterBuilder() .appendYear(4, 4) .appendFixedDecimal(DateTimeFieldType.monthOfYear(), 2) .appendFixedDecimal(DateTimeFieldType.dayOfMonth(), 2) .toFormatter(); } return bd; }
private void initBase() { if (era >= 0 ) base = JodaTimeUtils.setField(base, DateTimeFieldType.era(), era); if (year >= 0) base = JodaTimeUtils.setField(base, DateTimeFieldType.year(), year); if (month >= 0) base = JodaTimeUtils.setField(base, DateTimeFieldType.monthOfYear(), month); if (day >= 0) base = JodaTimeUtils.setField(base, DateTimeFieldType.dayOfMonth(), day); }
public static Partial resolveWeek(Partial p) { // Figure out week if (p.isSupported(DateTimeFieldType.dayOfMonth()) && p.isSupported(DateTimeFieldType.monthOfYear()) && p.isSupported(DateTimeFieldType.year())) { Instant t = getInstant(p); // return getPartial(t.toInstant(), p.without(DateTimeFieldType.dayOfMonth()).without(DateTimeFieldType.monthOfYear()).with(DateTimeFieldType.weekOfWeekyear(), 1)); return getPartial(t.toInstant(), p.with(DateTimeFieldType.weekOfWeekyear(), 1)); } else return p; }
protected void withStandardFields() { if (base.isSupported(DateTimeFieldType.dayOfWeek())) { base = JodaTimeUtils.resolveDowToDay(base); } else if (base.isSupported(DateTimeFieldType.monthOfYear()) && base.isSupported(DateTimeFieldType.dayOfMonth())) { if (base.isSupported(DateTimeFieldType.weekOfWeekyear())) { base = base.without(DateTimeFieldType.weekOfWeekyear()); } if (base.isSupported(DateTimeFieldType.dayOfWeek())) { base = base.without(DateTimeFieldType.dayOfWeek()); } } }