/** * Set the weekyear to the specified value. * * @param weekyear the weekyear * @throws IllegalArgumentException if the value is invalid */ public void setWeekyear(final int weekyear) { setMillis(getChronology().weekyear().set(getMillis(), weekyear)); }
/** * Set the date from milliseconds. * The time part of this object will be unaffected. * * @param instant an instant to copy the date from, time part ignored * @throws IllegalArgumentException if the value is invalid */ public void setDate(final long instant) { setMillis(getChronology().millisOfDay().set(instant, getMillisOfDay())); }
/** * Adds a period to this instant specifying how many times to add. * <p> * This will typically change the value of most fields. * * @param period the period to add, null means add zero * @param scalar direction and amount to add, which may be negative * @throws ArithmeticException if the result exceeds the capacity of the instant */ public void add(ReadablePeriod period, int scalar) { if (period != null) { setMillis(getChronology().add(period, getMillis(), scalar)); // set via this class not super } }
/** * Set the week of weekyear to the specified value. * * @param weekOfWeekyear the week of the weekyear * @throws IllegalArgumentException if the value is invalid */ public void setWeekOfWeekyear(final int weekOfWeekyear) { setMillis(getChronology().weekOfWeekyear().set(getMillis(), weekOfWeekyear)); }
/** * Adds a period to this instant specifying how many times to add. * <p> * This will typically change the value of most fields. * * @param period the period to add, null means add zero * @param scalar direction and amount to add, which may be negative * @throws ArithmeticException if the result exceeds the capacity of the instant */ public void add(ReadablePeriod period, int scalar) { if (period != null) { setMillis(getChronology().add(period, getMillis(), scalar)); // set via this class not super } }
/** * Sets a text value. * * @param text the text value to set * @param locale optional locale to use for selecting a text symbol * @return the mutable datetime being used, so calls can be chained * @throws IllegalArgumentException if the text value isn't valid * @see DateTimeField#set(long,java.lang.String,java.util.Locale) */ public MutableDateTime set(String text, Locale locale) { iInstant.setMillis(getField().set(iInstant.getMillis(), text, locale)); return iInstant; }
/** * Set the date from milliseconds. * The time part of this object will be unaffected. * * @param instant an instant to copy the date from, time part ignored * @throws IllegalArgumentException if the value is invalid */ public void setDate(final long instant) { setMillis(getChronology().millisOfDay().set(instant, getMillisOfDay())); }
/** * Set the day of year to the specified value. * * @param dayOfYear the day of the year * @throws IllegalArgumentException if the value is invalid */ public void setDayOfYear(final int dayOfYear) { setMillis(getChronology().dayOfYear().set(getMillis(), dayOfYear)); }
/** * Set the time from fields. * The date part of this object will be unaffected. * * @param hour the hour * @param minuteOfHour the minute of the hour * @param secondOfMinute the second of the minute * @param millisOfSecond the millisecond of the second * @throws IllegalArgumentException if the value is invalid */ public void setTime( final int hour, final int minuteOfHour, final int secondOfMinute, final int millisOfSecond) { long instant = getChronology().getDateTimeMillis( getMillis(), hour, minuteOfHour, secondOfMinute, millisOfSecond); setMillis(instant); }
/** * Round to the nearest whole unit of this field, favoring the ceiling if * halfway. * * @return the mutable datetime being used, so calls can be chained * @see DateTimeField#roundHalfCeiling */ public MutableDateTime roundHalfCeiling() { iInstant.setMillis(getField().roundHalfCeiling(iInstant.getMillis())); return iInstant; }
/** * Set the date from milliseconds. * The time part of this object will be unaffected. * * @param instant an instant to copy the date from, time part ignored * @throws IllegalArgumentException if the value is invalid */ public void setDate(final long instant) { setMillis(getChronology().millisOfDay().set(instant, getMillisOfDay())); }
/** * Set the minute of the day to the specified value. * <p> * Setting this will replace the values of minute-of-hour and hour-of-day. * * @param minuteOfDay the minute of day * @throws IllegalArgumentException if the value is invalid */ public void setMinuteOfDay(final int minuteOfDay) { setMillis(getChronology().minuteOfDay().set(getMillis(), minuteOfDay)); }
/** * Add a number of weekyears to the date. * * @param weekyears the weekyears to add * @throws IllegalArgumentException if the value is invalid */ public void addWeekyears(final int weekyears) { if (weekyears != 0) { setMillis(getChronology().weekyears().add(getMillis(), weekyears)); } }
/** * Sets a text value. * * @param text the text value to set * @param locale optional locale to use for selecting a text symbol * @return the mutable datetime being used, so calls can be chained * @throws IllegalArgumentException if the text value isn't valid * @see DateTimeField#set(long,java.lang.String,java.util.Locale) */ public MutableDateTime set(String text, Locale locale) { iInstant.setMillis(getField().set(iInstant.getMillis(), text, locale)); return iInstant; }
/** * Round to the nearest whole unit of this field. If halfway, the ceiling * is favored over the floor only if it makes this field's value even. * * @return the mutable datetime being used, so calls can be chained * @see DateTimeField#roundHalfEven */ public MutableDateTime roundHalfEven() { iInstant.setMillis(getField().roundHalfEven(iInstant.getMillis())); return iInstant; } }
/** * Set the minute of the hour to the specified value. * * @param minuteOfHour the minute of hour * @throws IllegalArgumentException if the value is invalid */ public void setMinuteOfHour(final int minuteOfHour) { setMillis(getChronology().minuteOfHour().set(getMillis(), minuteOfHour)); }