Timestamp ts = addMillis(amount); ts._precision = _precision; ts.clearUnusedPrecision();
/** * Returns a timestamp relative to this one by the given number of minutes. * * @param amount a (positive or negative) number of minutes. */ public final Timestamp addMinute(int amount) { long delta = (long) amount * 60 * 1000; return addMillis(delta); }
/** * Returns a timestamp relative to this one by the given number of days. * * @param amount a (positive or negative) number of hours. */ public final Timestamp addDay(int amount) { long delta = (long) amount * 24 * 60 * 60 * 1000; return addMillis(delta); }
/** * Returns a timestamp relative to this one by the given number of hours. * * @param amount a (positive or negative) number of hours. */ public final Timestamp addHour(int amount) { long delta = (long) amount * 60 * 60 * 1000; return addMillis(delta); }
/** * Returns a timestamp relative to this one by the given number of seconds. * * @param amount a (positive or negative) number of seconds. */ public final Timestamp addSecond(int amount) { long delta = (long) amount * 1000; return addMillis(delta); }
/** * Returns a timestamp relative to this one by the given number of hours. * * @param amount a (positive or negative) number of hours. */ public final Timestamp addHour(int amount) { long delta = (long) amount * 60 * 60 * 1000; return addMillis(delta); }
/** * Returns a timestamp relative to this one by the given number of seconds. * * @param amount a (positive or negative) number of seconds. */ public final Timestamp addSecond(int amount) { long delta = (long) amount * 1000; return addMillis(delta); }
/** * Returns a timestamp relative to this one by the given number of days. * * @param amount a (positive or negative) number of hours. */ public final Timestamp addDay(int amount) { long delta = (long) amount * 24 * 60 * 60 * 1000; return addMillis(delta); }
/** * Returns a timestamp relative to this one by the given number of minutes. * * @param amount a (positive or negative) number of minutes. */ public final Timestamp addMinute(int amount) { long delta = (long) amount * 60 * 1000; return addMillis(delta); }