Examples of minusMonths()


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

        // ensure there is at least one digit, and exactly one character suffix, and the suffix is a legal option
        if (!ctime.matches("^[0-9]+[yMwdhms]$")) throw new IllegalArgumentException("Invalid option for ctime: "+ctime);

        if (ctime.endsWith("y")) return dateTime.minusYears(getCtimeNumber(ctime)).getMillis();
        if (ctime.endsWith("M")) return dateTime.minusMonths(getCtimeNumber(ctime)).getMillis();
        if (ctime.endsWith("w")) return dateTime.minusWeeks(getCtimeNumber(ctime)).getMillis();
        if (ctime.endsWith("d")) return dateTime.minusDays(getCtimeNumber(ctime)).getMillis();
        if (ctime.endsWith("h")) return dateTime.minusHours(getCtimeNumber(ctime)).getMillis();
        if (ctime.endsWith("m")) return dateTime.minusMinutes(getCtimeNumber(ctime)).getMillis();
        if (ctime.endsWith("s")) return dateTime.minusSeconds(getCtimeNumber(ctime)).getMillis();
View Full Code Here

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

    for (int i = 0; i < counts.length; i++) {
      assertEquals("count at index " + i + " should be " + (i + 1), i + 1, counts[i]);
    }

    // Check a query for twelve months past
    counts = aggregateCounterRepository.getCounts(counterName, new Interval(end.minusMonths(11), end), AggregateCountResolution.month).getCounts();
    assertEquals(12, counts.length);

    counts = aggregateCounterRepository.getCounts(counterName, 3, end, AggregateCountResolution.month).getCounts();
    assertEquals(3, counts.length);
    assertEquals(6, counts[2]);
View Full Code Here

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

       
        Assert.assertEquals(2L, cubeWrapper.getUniqueUsersForDay(monthBegin));
        Assert.assertEquals(2L, cubeWrapper.getUniqueUsersForDay(monthBegin.minusDays(1)));
       
        Assert.assertEquals(2L, cubeWrapper.getUniqueUsersForMonth(monthBegin));
        Assert.assertEquals(2L, cubeWrapper.getUniqueUsersForMonth(monthBegin.minusMonths(1)));
    }
}
View Full Code Here

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

                           1,
                           0,
                           0,
                           0);
     
      firstDateOfMonth = firstDateOfMonth.minusMonths(PeriodSelector.this.numberOfPeriods);
     
      return firstDateOfMonth;
    }
    public DateTime getUpperBound(){
      DateTime lastDateOfMonth = new DateTime(this.year,
View Full Code Here

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

            List<Map<TagGroup, Double>> daily = Lists.newArrayList();
            List<Map<TagGroup, Double>> weekly = Lists.newArrayList();
            List<Map<TagGroup, Double>> monthly = Lists.newArrayList();

            // get last month data
            ReadWriteData lastMonthData = new DataWriter(prefix + "hourly_" + prodName + "_" + AwsUtils.monthDateFormat.print(monthDateTime.minusMonths(1)), true).getData();

            // aggregate to daily, weekly and monthly
            int dayOfWeek = monthDateTime.getDayOfWeek();
            int daysFromLastMonth = dayOfWeek - 1;
            int lastMonthNumHours = monthDateTime.minusMonths(1).dayOfMonth().getMaximumValue() * 24;
 
View Full Code Here

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

            ReadWriteData lastMonthData = new DataWriter(prefix + "hourly_" + prodName + "_" + AwsUtils.monthDateFormat.print(monthDateTime.minusMonths(1)), true).getData();

            // aggregate to daily, weekly and monthly
            int dayOfWeek = monthDateTime.getDayOfWeek();
            int daysFromLastMonth = dayOfWeek - 1;
            int lastMonthNumHours = monthDateTime.minusMonths(1).dayOfMonth().getMaximumValue() * 24;
            for (int hour = 0 - daysFromLastMonth * 24; hour < data.getNum(); hour++) {
                if (hour < 0) {
                    // handle data from last month, add to weekly
                    Map<TagGroup, Double> prevData = lastMonthData.getData(lastMonthNumHours + hour);
                    for (TagGroup tagGroup: tagGroups) {
View Full Code Here

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

        for (int i = 0; i < 12; i++) {
            // create a new period
            DateTimePeriod period = DateTimePeriod.createMonth(now.getYear(), now.getMonthOfYear(), zone);
            periods.add(period);
            // subtract 1 month
            now = now.minusMonths(1);
        }

        Collections.reverse(periods);

        return periods;
View Full Code Here

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

        for (int i = 0; i < 12; i++) {
            // create a new period
            DateTimePeriod period = createMonth(now.getYear(), now.getMonthOfYear(), zone);
            periods.add(period);
            // subtract 1 month
            now = now.minusMonths(1);
        }

        return periods;
    }
   
View Full Code Here

Examples of org.joda.time.LocalDate.minusMonths()

        intervalInitDate = intervalInitDate.minusMonths(1);
        assertTrue(resourceAllocationDAO.findAllocationsRelatedToAnyOf(current,
                resources,
                intervalInitDate, intervalEndDate).contains(resourceAllocation1));

        intervalEndDate = intervalEndDate.minusMonths(1);
        assertFalse(resourceAllocationDAO.findAllocationsRelatedToAnyOf(
                current, resources,
                intervalInitDate, intervalEndDate).contains(resourceAllocation1));

        assertTrue(resourceAllocationDAO.findAllocationsRelatedToAnyOf(current,
View Full Code Here

Examples of org.joda.time.LocalDate.minusMonths()

     * </p>
     */
    @Scheduled(cron = "0 0 0 * * ?")
    public void removeOldPersistentTokens() {
        LocalDate now = new LocalDate();
        List<PersistentToken> tokens = persistentTokenRepository.findByTokenDateBefore(now.minusMonths(1));
        for (PersistentToken token : tokens) {
            log.debug("Deleting token {}", token.getSeries());
            User user = token.getUser();
            user.getPersistentTokens().remove(token);
            persistentTokenRepository.delete(token);
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.