Package org.joda.time

Examples of org.joda.time.DateTime.plus()


            if (intervalStart != null) {
                DateTime itemStart = intervalStart;
                DateTime itemEnd = intervalStart.plus(intervalIncrease());
                while (intervalEnd.isAfter(itemStart)) {
                    if (intervalEnd.isBefore(itemEnd)
                            || !intervalEnd.isAfter(itemEnd
                                    .plus(intervalIncrease()))) {
                        itemEnd = intervalEnd;
                    }
                    Listitem item = new Listitem(Util.formatDate(itemStart)
                            + " - " + Util.formatDate(itemEnd.minusDays(1)));
View Full Code Here


                    }
                    Listitem item = new Listitem(Util.formatDate(itemStart)
                            + " - " + Util.formatDate(itemEnd.minusDays(1)));
                    horizontalPagination.appendChild(item);
                    itemStart = itemEnd;
                    itemEnd = itemEnd.plus(intervalIncrease());
                }
            }
            horizontalPagination.setSelectedIndex(0);

            // Disable pagination if there's only one page
View Full Code Here

            if (intervalStart != null) {
                DateTime itemStart = intervalStart;
                DateTime itemEnd = intervalStart.plus(intervalIncrease());
                while (intervalEnd.isAfter(itemStart)) {
                    if (intervalEnd.isBefore(itemEnd)
                            || itemEnd.plus(intervalIncrease()).isAfter(
                                    intervalEnd)) {
                        itemEnd = intervalEnd;
                    }
                    Listitem item = new Listitem(Util.formatDate(itemStart)
                            + " - " + Util.formatDate(itemEnd.minusDays(1)));
View Full Code Here

                    }
                    Listitem item = new Listitem(Util.formatDate(itemStart)
                            + " - " + Util.formatDate(itemEnd.minusDays(1)));
                    advancedAllocationHorizontalPagination.appendChild(item);
                    itemStart = itemEnd;
                    itemEnd = itemEnd.plus(intervalIncrease());
                }
            }
            advancedAllocationHorizontalPagination
                    .setDisabled(advancedAllocationHorizontalPagination
                            .getItems().size() < 2);
View Full Code Here

        try {
            XMLObject metadata = fetchMetadata();

            log.debug("Calculating expiration time");
            DateTime now = new DateTime();
            mdExpirationTime = SAML2Helper.getEarliestExpiration(metadata, now.plus(maxCacheDuration * 1000), now);
            log.debug("Metadata cache expires on " + mdExpirationTime);

            if (mdExpirationTime != null && !maintainExpiredMetadata() && mdExpirationTime.isBeforeNow()) {
                cachedMetadata = null;
            } else {
View Full Code Here

    final int offsetFromUTC = tz.getOffset(msFromEpochGmt);

    // create a new calendar in GMT timezone, set to this date and add the
    // offset
    DateTime newTime = new DateTime(theDate.getTime(), DateTimeZone.UTC);
    newTime = newTime.plus(offsetFromUTC);
    // Return all day appointments as 00:00Z regardless of time zone
    if (isAllDay) {
      newTime = newTime.withHourOfDay(0).withMinuteOfHour(0).withSecondOfMinute(0);
    }
    return newTime;
View Full Code Here

        final DateTime newestPortalEventTimestamp = this.portalEventDao.getNewestPortalEventTimestamp();
        if (newestPortalEventTimestamp == null || now.isAfter(newestPortalEventTimestamp)) {
            endIntervalInfo = this.intervalHelper.getIntervalInfo(AggregationInterval.YEAR, now.plus(this.dimensionBuffer));
        }
        else {
            endIntervalInfo = this.intervalHelper.getIntervalInfo(AggregationInterval.YEAR, newestPortalEventTimestamp.plus(this.dimensionBuffer));
        }
       
        final DateMidnight start = startIntervalInfo.getStart().toDateMidnight();
        final DateMidnight end = endIntervalInfo.getEnd().toDateMidnight();
       
View Full Code Here

    DateTime now = new DateTime();
    C last;

    synchronized (this) {
      if (eventCounters.isEmpty() || !now.isBefore(eventCounters.getLast().getEnd())) {
        addEventCounter(nextCounter(now, now.plus(maxChunkLength)));
      }

      last = eventCounters.getLast();
    }
View Full Code Here

    return new DateTime(year, 1, 1, 0, 0);
  }

  public DateTime randomDateBetweenNowAndFuturePeriod(Period futurePeriod) {
    DateTime now = timeProvider.getCurrentDate();
    return new DateTime(baseProducer.randomBetween(now.getMillis(), now.plus(futurePeriod).getMillis()));
  }

  public DateTime randomDateInTheFuture(int years) {
    return randomDateBetweenNowAndFuturePeriod(Period.years(years));
  }
View Full Code Here

    final DateTime end = start.plusMinutes(66);
    DateTime now = start;
    int val = 1;
    while (now.isBefore(end)) {
      aggregateCounterRepository.increment(counterName, val++, now);
      now = now.plus(Duration.standardMinutes(1));
    }
    // Include 66th minute's value
    aggregateCounterRepository.increment(counterName, val++, now);
    long[] counts = aggregateCounterRepository.getCounts(counterName, new Interval(start, end), AggregateCountResolution.minute).getCounts();
    // the counts.length should be 66 + 1 to include the 66th minute's count
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.