/** * Returns a copy of this datetime plus the specified number of minutes. * <p> * The calculation will add a duration equivalent to the number of minutes * expressed in milliseconds. * <p> * The following three lines are identical in effect: * <pre> * DateTime added = dt.plusMinutes(6); * DateTime added = dt.plus(Period.minutes(6)); * DateTime added = dt.withFieldAdded(DurationFieldType.minutes(), 6); * </pre> * <p> * This datetime instance is immutable and unaffected by this method call. * * @param minutes the amount of minutes to add, may be negative * @return the new datetime plus the increased minutes * @since 1.1 */ public DateTime plusMinutes(int minutes) { if (minutes == 0) { return this; } long instant = getChronology().minutes().add(getMillis(), minutes); return withMillis(instant); }
/** * Returns a copy of this datetime minus the specified number of minutes. * <p> * The calculation will subtract a duration equivalent to the number of * minutes expressed in milliseconds. * <p> * The following three lines are identical in effect: * <pre> * DateTime subtracted = dt.minusMinutes(6); * DateTime subtracted = dt.minus(Period.minutes(6)); * DateTime subtracted = dt.withFieldAdded(DurationFieldType.minutes(), -6); * </pre> * <p> * This datetime instance is immutable and unaffected by this method call. * * @param minutes the amount of minutes to subtract, may be negative * @return the new datetime minus the increased minutes * @since 1.1 */ public DateTime minusMinutes(int minutes) { if (minutes == 0) { return this; } long instant = getChronology().minutes().subtract(getMillis(), minutes); return withMillis(instant); }
/** * Returns a copy of this datetime plus the specified number of minutes. * <p> * The calculation will add a duration equivalent to the number of minutes * expressed in milliseconds. * <p> * The following three lines are identical in effect: * <pre> * DateTime added = dt.plusMinutes(6); * DateTime added = dt.plus(Period.minutes(6)); * DateTime added = dt.withFieldAdded(DurationFieldType.minutes(), 6); * </pre> * <p> * This datetime instance is immutable and unaffected by this method call. * * @param minutes the amount of minutes to add, may be negative * @return the new datetime plus the increased minutes * @since 1.1 */ public DateTime plusMinutes(int minutes) { if (minutes == 0) { return this; } long instant = getChronology().minutes().add(getMillis(), minutes); return withMillis(instant); }
/** * Returns a copy of this datetime minus the specified number of minutes. * <p> * The calculation will subtract a duration equivalent to the number of * minutes expressed in milliseconds. * <p> * The following three lines are identical in effect: * <pre> * DateTime subtracted = dt.minusMinutes(6); * DateTime subtracted = dt.minus(Period.minutes(6)); * DateTime subtracted = dt.withFieldAdded(DurationFieldType.minutes(), -6); * </pre> * <p> * This datetime instance is immutable and unaffected by this method call. * * @param minutes the amount of minutes to subtract, may be negative * @return the new datetime minus the increased minutes * @since 1.1 */ public DateTime minusMinutes(int minutes) { if (minutes == 0) { return this; } long instant = getChronology().minutes().subtract(getMillis(), minutes); return withMillis(instant); }
/** * Add a number of minutes to the date. * * @param minutes the minutes to add * @throws IllegalArgumentException if the value is invalid */ public void addMinutes(final int minutes) { if (minutes != 0) { setMillis(getChronology().minutes().add(getMillis(), minutes)); } }
/** * Add a number of minutes to the date. * * @param minutes the minutes to add * @throws IllegalArgumentException if the value is invalid */ public void addMinutes(final int minutes) { if (minutes != 0) { setMillis(getChronology().minutes().add(getMillis(), minutes)); } }
/** * Returns a copy of this datetime minus the specified number of minutes. * <p> * This LocalDateTime instance is immutable and unaffected by this method call. * <p> * The following three lines are identical in effect: * <pre> * LocalDateTime subtracted = dt.minusMinutes(6); * LocalDateTime subtracted = dt.minus(Period.minutes(6)); * LocalDateTime subtracted = dt.withFieldAdded(DurationFieldType.minutes(), -6); * </pre> * * @param minutes the amount of minutes to subtract, may be negative * @return the new LocalDateTime minus the increased minutes */ public LocalDateTime minusMinutes(int minutes) { if (minutes == 0) { return this; } long instant = getChronology().minutes().subtract(getLocalMillis(), minutes); return withLocalMillis(instant); }
/** * Returns a copy of this time plus the specified number of minutes. * <p> * This LocalTime instance is immutable and unaffected by this method call. * <p> * The following three lines are identical in effect: * <pre> * LocalTime added = dt.plusMinutes(6); * LocalTime added = dt.plus(Period.minutes(6)); * LocalTime added = dt.withFieldAdded(DurationFieldType.minutes(), 6); * </pre> * * @param minutes the amount of minutes to add, may be negative * @return the new LocalTime plus the increased minutes */ public LocalTime plusMinutes(int minutes) { if (minutes == 0) { return this; } long instant = getChronology().minutes().add(getLocalMillis(), minutes); return withLocalMillis(instant); }
/** * Returns a copy of this datetime plus the specified number of minutes. * <p> * This LocalDateTime instance is immutable and unaffected by this method call. * <p> * The following three lines are identical in effect: * <pre> * LocalDateTime added = dt.plusMinutes(6); * LocalDateTime added = dt.plus(Period.minutes(6)); * LocalDateTime added = dt.withFieldAdded(DurationFieldType.minutes(), 6); * </pre> * * @param minutes the amount of minutes to add, may be negative * @return the new LocalDateTime plus the increased minutes */ public LocalDateTime plusMinutes(int minutes) { if (minutes == 0) { return this; } long instant = getChronology().minutes().add(getLocalMillis(), minutes); return withLocalMillis(instant); }
/** * Returns a copy of this time minus the specified number of minutes. * <p> * This LocalTime instance is immutable and unaffected by this method call. * <p> * The following three lines are identical in effect: * <pre> * LocalTime subtracted = dt.minusMinutes(6); * LocalTime subtracted = dt.minus(Period.minutes(6)); * LocalTime subtracted = dt.withFieldAdded(DurationFieldType.minutes(), -6); * </pre> * * @param minutes the amount of minutes to subtract, may be negative * @return the new LocalTime minus the increased minutes */ public LocalTime minusMinutes(int minutes) { if (minutes == 0) { return this; } long instant = getChronology().minutes().subtract(getLocalMillis(), minutes); return withLocalMillis(instant); }
/** * Returns a copy of this time plus the specified number of minutes. * <p> * This LocalTime instance is immutable and unaffected by this method call. * <p> * The following three lines are identical in effect: * <pre> * LocalTime added = dt.plusMinutes(6); * LocalTime added = dt.plus(Period.minutes(6)); * LocalTime added = dt.withFieldAdded(DurationFieldType.minutes(), 6); * </pre> * * @param minutes the amount of minutes to add, may be negative * @return the new LocalTime plus the increased minutes */ public LocalTime plusMinutes(int minutes) { if (minutes == 0) { return this; } long instant = getChronology().minutes().add(getLocalMillis(), minutes); return withLocalMillis(instant); }
/** * Returns a copy of this time minus the specified number of minutes. * <p> * This LocalTime instance is immutable and unaffected by this method call. * <p> * The following three lines are identical in effect: * <pre> * LocalTime subtracted = dt.minusMinutes(6); * LocalTime subtracted = dt.minus(Period.minutes(6)); * LocalTime subtracted = dt.withFieldAdded(DurationFieldType.minutes(), -6); * </pre> * * @param minutes the amount of minutes to subtract, may be negative * @return the new LocalTime minus the increased minutes */ public LocalTime minusMinutes(int minutes) { if (minutes == 0) { return this; } long instant = getChronology().minutes().subtract(getLocalMillis(), minutes); return withLocalMillis(instant); }
/** * Returns a copy of this datetime minus the specified number of minutes. * <p> * This LocalDateTime instance is immutable and unaffected by this method call. * <p> * The following three lines are identical in effect: * <pre> * LocalDateTime subtracted = dt.minusMinutes(6); * LocalDateTime subtracted = dt.minus(Period.minutes(6)); * LocalDateTime subtracted = dt.withFieldAdded(DurationFieldType.minutes(), -6); * </pre> * * @param minutes the amount of minutes to subtract, may be negative * @return the new LocalDateTime minus the increased minutes */ public LocalDateTime minusMinutes(int minutes) { if (minutes == 0) { return this; } long instant = getChronology().minutes().subtract(getLocalMillis(), minutes); return withLocalMillis(instant); }
/** * Returns a copy of this datetime plus the specified number of minutes. * <p> * This LocalDateTime instance is immutable and unaffected by this method call. * <p> * The following three lines are identical in effect: * <pre> * LocalDateTime added = dt.plusMinutes(6); * LocalDateTime added = dt.plus(Period.minutes(6)); * LocalDateTime added = dt.withFieldAdded(DurationFieldType.minutes(), 6); * </pre> * * @param minutes the amount of minutes to add, may be negative * @return the new LocalDateTime plus the increased minutes */ public LocalDateTime plusMinutes(int minutes) { if (minutes == 0) { return this; } long instant = getChronology().minutes().add(getLocalMillis(), minutes); return withLocalMillis(instant); }
/** * Creates a <code>Minutes</code> representing the number of whole minutes * between the two specified partial datetimes. * <p> * The two partials must contain the same fields, for example you can specify * two <code>LocalTime</code> objects. * * @param start the start partial date, must not be null * @param end the end partial date, must not be null * @return the period in minutes * @throws IllegalArgumentException if the partials are null or invalid */ public static Minutes minutesBetween(ReadablePartial start, ReadablePartial end) { if (start instanceof LocalTime && end instanceof LocalTime) { Chronology chrono = DateTimeUtils.getChronology(start.getChronology()); int minutes = chrono.minutes().getDifference( ((LocalTime) end).getLocalMillis(), ((LocalTime) start).getLocalMillis()); return Minutes.minutes(minutes); } int amount = BaseSingleFieldPeriod.between(start, end, ZERO); return Minutes.minutes(amount); }
/** * Creates a <code>Minutes</code> representing the number of whole minutes * between the two specified partial datetimes. * <p> * The two partials must contain the same fields, for example you can specify * two <code>LocalTime</code> objects. * * @param start the start partial date, must not be null * @param end the end partial date, must not be null * @return the period in minutes * @throws IllegalArgumentException if the partials are null or invalid */ public static Minutes minutesBetween(ReadablePartial start, ReadablePartial end) { if (start instanceof LocalTime && end instanceof LocalTime) { Chronology chrono = DateTimeUtils.getChronology(start.getChronology()); int minutes = chrono.minutes().getDifference( ((LocalTime) end).getLocalMillis(), ((LocalTime) start).getLocalMillis()); return Minutes.minutes(minutes); } int amount = BaseSingleFieldPeriod.between(start, end, ZERO); return Minutes.minutes(amount); }
return chronology.hours(); case MINUTES: return chronology.minutes(); case SECONDS: return chronology.seconds();
return chronology.hours(); case MINUTES: return chronology.minutes(); case SECONDS: return chronology.seconds();
seconds = f; if (isSupported(f = chrono.minutes())) { minutes = f;