/** * Restricted constructor. */ BasicDayOfMonthDateTimeField(BasicChronology chronology, DurationField days) { super(DateTimeFieldType.dayOfMonth(), days); iChronology = chronology; }
/** * Restricted constructor. */ BasicDayOfMonthDateTimeField(BasicChronology chronology, DurationField days) { super(DateTimeFieldType.dayOfMonth(), days); iChronology = chronology; }
/** * Instructs the printer to emit a numeric dayOfMonth field. * * @param minDigits minimum number of digits to print * @return this DateTimeFormatterBuilder, for chaining */ public DateTimeFormatterBuilder appendDayOfMonth(int minDigits) { return appendDecimal(DateTimeFieldType.dayOfMonth(), minDigits, 2); }
/** * Instructs the printer to emit a numeric dayOfMonth field. * * @param minDigits minimum number of digits to print * @return this DateTimeFormatterBuilder, for chaining */ public DateTimeFormatterBuilder appendDayOfMonth(int minDigits) { return appendDecimal(DateTimeFieldType.dayOfMonth(), minDigits, 2); }
/** * 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); }
/** * 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 appendDayOfMonth(int digits) { builder.appendDayOfMonth(digits); appendNumericField(DateTimeFieldType.dayOfMonth(), digits); } protected void appendDayOfWeek(int digits) {
@Override public DateTimeFieldType[] getDateTimeFields() { return new DateTimeFieldType[] { DateTimeFieldType.dayOfMonth(), DateTimeFieldType.dayOfWeek(), DateTimeFieldType.dayOfYear() }; } private static final long serialVersionUID = 1;
/** * Get the day of month field for this chronology. * * @return DateTimeField or UnsupportedDateTimeField if unsupported */ public DateTimeField dayOfMonth() { return UnsupportedDateTimeField.getInstance(DateTimeFieldType.dayOfMonth(), days()); }
/** * Get the day of month field for this chronology. * * @return DateTimeField or UnsupportedDateTimeField if unsupported */ public DateTimeField dayOfMonth() { return UnsupportedDateTimeField.getInstance(DateTimeFieldType.dayOfMonth(), days()); }
@Override public boolean hasTime() { if (base == null) return false; DateTimeFieldType sdft = JodaTimeUtils.getMostSpecific(base); if (sdft != null && JodaTimeUtils.isMoreGeneral(DateTimeFieldType.dayOfMonth(), sdft, base.getChronology())) { return true; } else { return false; } }
public static Partial resolveDowToDay(Partial p1, Partial p2) { // Discard anything that's more specific than dayOfMonth for p2 p2 = JodaTimeUtils.discardMoreSpecificFields(p2, DateTimeFieldType.dayOfMonth()); if (isCompatible(p1,p2)) { if (p1.isSupported(DateTimeFieldType.dayOfWeek())) { if (!p1.isSupported(DateTimeFieldType.dayOfMonth())) { if (p2.isSupported(DateTimeFieldType.dayOfMonth()) && p2.isSupported(DateTimeFieldType.monthOfYear()) && p2.isSupported(DateTimeFieldType.year())) { Instant t2 = getInstant(p2); DateTime t1 = p1.toDateTime(t2); return getPartial(t1.toInstant(), p1.with(DateTimeFieldType.dayOfMonth(), 1)/*.with(DateTimeFieldType.weekOfWeekyear(), 1) */); } } } } return p1; }
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()); } }
public static Partial resolveWeek(Partial p1, Partial p2) { if (isCompatible(p1,p2)) { if (!p1.isSupported(DateTimeFieldType.dayOfMonth())) { if (p2.isSupported(DateTimeFieldType.dayOfMonth()) && p2.isSupported(DateTimeFieldType.monthOfYear()) && p2.isSupported(DateTimeFieldType.year())) { Instant t2 = getInstant(p2); DateTime t1 = p1.toDateTime(t2); return getPartial(t1.toInstant(), p1.without(DateTimeFieldType.dayOfMonth()).without(DateTimeFieldType.monthOfYear()).with(DateTimeFieldType.weekOfWeekyear(), 1)); } } } return p1; } public static Partial resolveWeek(Partial p)
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 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()); } } }