Roll the java.util.Time forward or backward.

@param startDate - The start date
@param period Calendar.YEAR etc
@param amount - Negative to rollbackwards.
434525
public static java.sql.Time rollTime(java.util.Date startDate, int period, int amount) {
        GregorianCalendar gc = new GregorianCalendar();
        gc.setTime(startDate);
        gc.add(period, amount);
        return new java.sql.Time(gc.getTime().getTime());
    }
492134
public final synchronized Date evalDateNextPeriodStart(
    final Map<String, Object> pAddParam,
      final Date pDateFor) throws Exception {
    EPeriod period = evalBalanceStorePeriod(pAddParam);
    if (!(period.equals(EPeriod.MONTHLY)
      || period.equals(EPeriod.WEEKLY)
        || period.equals(EPeriod.DAILY))) {
      throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER,
        "stored_balance_period_must_be_dwm");
    }
    Calendar cal = Calendar.getInstance(new Locale("en", "US"));
    cal.setTime(pDateFor);
    cal.set(Calendar.HOUR_OF_DAY, 0);
    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.SECOND, 0);
    cal.set(Calendar.MILLISECOND, 0);
    if (period.equals(EPeriod.DAILY)) {
      cal.add(Calendar.DATE, 1);
    } else if (period.equals(EPeriod.MONTHLY)) {
      cal.add(Calendar.MONTH, 1);
      cal.set(Calendar.DAY_OF_MONTH, 1);
    } else if (period.equals(EPeriod.WEEKLY)) {
      cal.add(Calendar.DAY_OF_YEAR, 7);
      cal.set(Calendar.DAY_OF_WEEK, 1);
    }
    return cal.getTime();
  }
759063
public static Date addHour(String date, int amount) throws ParseException {
        return add(date, Calendar.HOUR, amount);
    }
1080897
public LocalDate adjustDate(LocalDate startDate, int increment, NonWorkingDayChecker<LocalDate> checker) {
        LocalDate date = startDate;
        final int month = date.getMonthOfYear();
        int stepToUse = increment;
        while (checker.isNonWorkingDay(date)) {
            date = date.plusDays(stepToUse);
            if (date.getMonthOfYear() != month) {
                // flick to backward
                stepToUse *= -1;
                date = date.plusDays(stepToUse);
            }
        }
        return date;
    }
82437
def get_start_balance(self, before: date) -> Decimal:
        
        assert isinstance(before, datetime)

        # create a new date without hours
        datum = Datum()
        datum.from_date(before)
        #date_corrected = datetimeutils.start_of_day(before)
        # now subtract 1 second.
        #date_corrected -= timedelta(seconds=1)
        #log(DEBUG, "getting balance on %s", date_corrected)
        datum.yesterday()
        datum.end_of_day()
        return self.get_balance_on(datum.value)
452374
def advance_by(self, amount):
        
        if amount < 0:
            raise ValueError("cannot retreat time reference: amount {} < 0"
                             .format(amount))
        self.__delta += amount
1343265
public Date setStartDate(Date time)
    {
        try   {
            this.getTable().edit();
            this.getField("StartDateTime").setData(time);
            this.getTable().set(this);
            this.getTable().seek(null);    // Read this record
        } catch (Exception ex)  {
            ex.printStackTrace();
        }
        return this.getStartDate();
    }
723702
def rollback(self, date):
        """"""
        if self.onOffset(date):
            return date
        else:
            return date - YearEnd(month=self.month)
205096
public Date adjustDate(final Date startDate, final int increment, final NonWorkingDayChecker<Date> checker) {
        final Calendar cal = Utils.getCal(startDate);

        while (checker.isNonWorkingDay(cal.getTime())) {
            if (increment < 0) {
                cal.add(Calendar.DAY_OF_MONTH, -1);
            } else {
                cal.add(Calendar.DAY_OF_MONTH, 1);
            }
        }

        return cal.getTime();
    }
1134549
public static Date add(String date, int field, int amount) throws ParseException {
        return add(Formatter.stringToDatetime(date), field, amount);
    }
752112
def rollback(self, date):
        """"""
        if self.onOffset(date):
            return date
        else:
            return date - QuarterBegin(month=self.month)
402067
public static Date addSecond(Date date, int amount) {
        return add(date, Calendar.SECOND, amount);
    }
210199
public void setStartdate(Object objStartDate) throws PageException {
	if (StringUtil.isEmpty(objStartDate)) return;
	this.startdate = new DateImpl(DateCaster.toDateAdvanced(objStartDate, pageContext.getTimeZone()));
    }
1358064
def roll_forward(self, dt):
        
        dt = pd.Timestamp(dt, tz='UTC')

        trading_days = self.all_sessions()
        try:
            return trading_days[trading_days.searchsorted(dt)]
        except IndexError:
            raise ValueError(
                "Date {} was past the last session for domain {}. "
                "The last session for this domain is {}.".format(
                    dt.date(),
                    self,
                    trading_days[-1].date()
                )
            )
646791
def rollforward(self, date):
        """"""
        if self.onOffset(date):
            return date
        else:
            return date + YearBegin(month=self.month)
1271996
public static Date addYears(Date date, int amount) {
        return org.apache.commons.lang.time.DateUtils.addYears(date, amount);
    }
810603
@Override
    public void begin() throws NotSupportedException, SystemException
    {
        if (log.isDebugEnabled())
            log.info("beginning JTA transaction");

        Transaction tx = threadLocal.get();
        if (tx != null)
        {
            if ((tx.getStatus() == Status.STATUS_MARKED_ROLLBACK))
            {
                throw new NotSupportedException("Nested Transaction not supported!");
            }
        }

        Integer timer = timerThead.get();
        threadLocal.set(new KunderaTransaction(timer != null ? timer : DEFAULT_TIME_OUT));
    }