/** * Returns a copy of this datetime with the specified duration taken away. * <p> * If the amount is zero or null, then <code>this</code> is returned. * This datetime instance is immutable and unaffected by this method call. * * @param duration the duration to reduce this instant by * @return a copy of this datetime with the duration taken away * @throws ArithmeticException if the new datetime exceeds the capacity of a long */ public DateTime minus(ReadableDuration duration) { return withDurationAdded(duration, -1); }
/** * Returns a copy of this datetime with the specified duration added. * <p> * If the amount is zero or null, then <code>this</code> is returned. * This datetime instance is immutable and unaffected by this method call. * * @param duration the duration to add to this one, null means zero * @return a copy of this datetime with the duration added * @throws ArithmeticException if the new datetime exceeds the capacity of a long */ public DateTime plus(ReadableDuration duration) { return withDurationAdded(duration, 1); }
/** * Returns a copy of this datetime with the specified duration taken away. * <p> * If the amount is zero or null, then <code>this</code> is returned. * This datetime instance is immutable and unaffected by this method call. * * @param duration the duration, in millis, to reduce this instant by * @return a copy of this datetime with the duration taken away * @throws ArithmeticException if the new datetime exceeds the capacity of a long */ public DateTime minus(long duration) { return withDurationAdded(duration, -1); }
/** * Returns a copy of this datetime with the specified duration added. * <p> * If the amount is zero or null, then <code>this</code> is returned. * This datetime instance is immutable and unaffected by this method call. * * @param duration the duration, in millis, to add to this one * @return a copy of this datetime with the duration added * @throws ArithmeticException if the new datetime exceeds the capacity of a long */ public DateTime plus(long duration) { return withDurationAdded(duration, 1); }
/** * Returns a copy of this datetime with the specified duration added. * <p> * If the amount is zero or null, then <code>this</code> is returned. * This datetime instance is immutable and unaffected by this method call. * * @param duration the duration to add to this one, null means zero * @return a copy of this datetime with the duration added * @throws ArithmeticException if the new datetime exceeds the capacity of a long */ public DateTime plus(ReadableDuration duration) { return withDurationAdded(duration, 1); }
/** * Returns a copy of this datetime with the specified duration added. * <p> * If the amount is zero or null, then <code>this</code> is returned. * This datetime instance is immutable and unaffected by this method call. * * @param duration the duration, in millis, to add to this one * @return a copy of this datetime with the duration added * @throws ArithmeticException if the new datetime exceeds the capacity of a long */ public DateTime plus(long duration) { return withDurationAdded(duration, 1); }
/** * Returns a copy of this datetime with the specified duration taken away. * <p> * If the amount is zero or null, then <code>this</code> is returned. * This datetime instance is immutable and unaffected by this method call. * * @param duration the duration to reduce this instant by * @return a copy of this datetime with the duration taken away * @throws ArithmeticException if the new datetime exceeds the capacity of a long */ public DateTime minus(ReadableDuration duration) { return withDurationAdded(duration, -1); }
/** * Returns a copy of this datetime with the specified duration taken away. * <p> * If the amount is zero or null, then <code>this</code> is returned. * This datetime instance is immutable and unaffected by this method call. * * @param duration the duration, in millis, to reduce this instant by * @return a copy of this datetime with the duration taken away * @throws ArithmeticException if the new datetime exceeds the capacity of a long */ public DateTime minus(long duration) { return withDurationAdded(duration, -1); }
/** * Returns a copy of this datetime with the specified duration added. * <p> * If the addition is zero, then <code>this</code> is returned. * * @param durationToAdd the duration to add to this one, null means zero * @param scalar the amount of times to add, such as -1 to subtract once * @return a copy of this datetime with the duration added * @throws ArithmeticException if the new datetime exceeds the capacity of a long */ public DateTime withDurationAdded(ReadableDuration durationToAdd, int scalar) { if (durationToAdd == null || scalar == 0) { return this; } return withDurationAdded(durationToAdd.getMillis(), scalar); }
/** * Returns a copy of this datetime with the specified duration added. * <p> * If the addition is zero, then <code>this</code> is returned. * * @param durationToAdd the duration to add to this one, null means zero * @param scalar the amount of times to add, such as -1 to subtract once * @return a copy of this datetime with the duration added * @throws ArithmeticException if the new datetime exceeds the capacity of a long */ public DateTime withDurationAdded(ReadableDuration durationToAdd, int scalar) { if (durationToAdd == null || scalar == 0) { return this; } return withDurationAdded(durationToAdd.getMillis(), scalar); }
/** * Returns a copy of this datetime with the specified duration added. * <p> * If the amount is zero or null, then <code>this</code> is returned. * This datetime instance is immutable and unaffected by this method call. * * @param duration the duration to add to this one, null means zero * @return a copy of this datetime with the duration added * @throws ArithmeticException if the new datetime exceeds the capacity of a long */ public DateTime plus(ReadableDuration duration) { return withDurationAdded(duration, 1); }
/** * Returns a copy of this datetime with the specified duration taken away. * <p> * If the amount is zero or null, then <code>this</code> is returned. * This datetime instance is immutable and unaffected by this method call. * * @param duration the duration, in millis, to reduce this instant by * @return a copy of this datetime with the duration taken away * @throws ArithmeticException if the new datetime exceeds the capacity of a long */ public DateTime minus(long duration) { return withDurationAdded(duration, -1); }
/** * Returns a copy of this datetime with the specified duration taken away. * <p> * If the amount is zero or null, then <code>this</code> is returned. * This datetime instance is immutable and unaffected by this method call. * * @param duration the duration to reduce this instant by * @return a copy of this datetime with the duration taken away * @throws ArithmeticException if the new datetime exceeds the capacity of a long */ public DateTime minus(ReadableDuration duration) { return withDurationAdded(duration, -1); }
/** * Returns a copy of this datetime with the specified duration added. * <p> * If the amount is zero or null, then <code>this</code> is returned. * This datetime instance is immutable and unaffected by this method call. * * @param duration the duration, in millis, to add to this one * @return a copy of this datetime with the duration added * @throws ArithmeticException if the new datetime exceeds the capacity of a long */ public DateTime plus(long duration) { return withDurationAdded(duration, 1); }
/** * Returns a copy of this datetime with the specified duration added. * <p> * If the addition is zero, then <code>this</code> is returned. * * @param durationToAdd the duration to add to this one, null means zero * @param scalar the amount of times to add, such as -1 to subtract once * @return a copy of this datetime with the duration added * @throws ArithmeticException if the new datetime exceeds the capacity of a long */ public DateTime withDurationAdded(ReadableDuration durationToAdd, int scalar) { if (durationToAdd == null || scalar == 0) { return this; } return withDurationAdded(durationToAdd.getMillis(), scalar); }
/** * Returns a copy of this datetime with the specified duration taken away. * <p> * If the amount is zero or null, then <code>this</code> is returned. * This datetime instance is immutable and unaffected by this method call. * * @param duration the duration to reduce this instant by * @return a copy of this datetime with the duration taken away * @throws ArithmeticException if the new datetime exceeds the capacity of a long */ public DateTime minus(ReadableDuration duration) { return withDurationAdded(duration, -1); }
/** * Returns a copy of this datetime with the specified duration added. * <p> * If the amount is zero or null, then <code>this</code> is returned. * This datetime instance is immutable and unaffected by this method call. * * @param duration the duration, in millis, to add to this one * @return a copy of this datetime with the duration added * @throws ArithmeticException if the new datetime exceeds the capacity of a long */ public DateTime plus(long duration) { return withDurationAdded(duration, 1); }
/** * Returns a copy of this datetime with the specified duration added. * <p> * If the amount is zero or null, then <code>this</code> is returned. * This datetime instance is immutable and unaffected by this method call. * * @param duration the duration, in millis, to add to this one * @return a copy of this datetime with the duration added * @throws ArithmeticException if the new datetime exceeds the capacity of a long */ public DateTime plus(long duration) { return withDurationAdded(duration, 1); }
/** * Returns a copy of this datetime with the specified duration taken away. * <p> * If the amount is zero or null, then <code>this</code> is returned. * This datetime instance is immutable and unaffected by this method call. * * @param duration the duration, in millis, to reduce this instant by * @return a copy of this datetime with the duration taken away * @throws ArithmeticException if the new datetime exceeds the capacity of a long */ public DateTime minus(long duration) { return withDurationAdded(duration, -1); }
/** * Returns a copy of this datetime with the specified duration taken away. * <p> * If the amount is zero or null, then <code>this</code> is returned. * This datetime instance is immutable and unaffected by this method call. * * @param duration the duration to reduce this instant by * @return a copy of this datetime with the duration taken away * @throws ArithmeticException if the new datetime exceeds the capacity of a long */ public DateTime minus(ReadableDuration duration) { return withDurationAdded(duration, -1); }