Package org.joda.time

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


       
        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

                           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

            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

            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

        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

        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

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.