Package org.joda.time

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


            new DateTime("2012-12-01T00:00:00.000-08:00"),
            new DateTime("2013-01-01T00:00:00.000-08:00"),
            new DateTime("2013-02-01T00:00:00.000-08:00")
        ),
        new PeriodGranularity(new Period("P1M"), null, tz)
            .iterable(baseTime.getMillis(), baseTime.plus(Months.months(3)).getMillis())
    );
  }

  @Test
  public void testIterableWeek() throws Exception
View Full Code Here


            new DateTime("2012-11-05T00:00:00.000-08:00"),
            new DateTime("2012-11-12T00:00:00.000-08:00"),
            new DateTime("2012-11-19T00:00:00.000-08:00")
        ),
        new PeriodGranularity(new Period("P1W"), null, tz)
            .iterable(baseTime.getMillis(), baseTime.plus(Weeks.weeks(3)).getMillis())
    );

    assertSame(
        Lists.newArrayList(
            new DateTime("2012-11-03T10:00:00.000-07:00"),
View Full Code Here

            new DateTime("2012-11-03T10:00:00.000-07:00"),
            new DateTime("2012-11-10T10:00:00.000-08:00"),
            new DateTime("2012-11-17T10:00:00.000-08:00")
        ),
        new PeriodGranularity(new Period("P1W"), baseTime, tz)
            .iterable(baseTime.getMillis(), baseTime.plus(Weeks.weeks(3)).getMillis())
    );
  }

  @Test
  public void testPeriodTruncateDays() throws Exception
View Full Code Here

  {
    final DateTime baseTime = new DateTime("2011-01-01T00:00:00.000Z");

    assertSame(
        Lists.newArrayList(baseTime),
        QueryGranularity.ALL.iterable(baseTime.getMillis(), baseTime.plus(Days.days(3)).getMillis())
    );
  }

  @Test
  public void testIterableAllComplex() throws Exception
View Full Code Here

  {
    final DateTime baseTime = new DateTime("2011-01-01T09:38:02.992Z");

    assertSame(
        Lists.newArrayList(baseTime),
        QueryGranularity.ALL.iterable(baseTime.getMillis(), baseTime.plus(Days.days(3)).getMillis())
    );
  }

  @Test
  public void testSerializePeriod() throws Exception
View Full Code Here

    Assert.assertTrue(
        "These timestamps have to be at the end AND include now for this test to work.",
        overallStart.isAfter(timeline.incompletePartitionsTimeline.lastEntry().getKey().getEnd())
    );

    final Interval oneHourInterval1 = new Interval(overallStart.plus(Hours.THREE), overallStart.plus(Hours.FOUR));
    final Interval oneHourInterval2 = new Interval(overallStart.plus(Hours.FOUR), overallStart.plus(Hours.FIVE));

    add(oneHourInterval1, "1", 1);
    add(oneHourInterval2, "1", 1);
    add(new Interval(overallStart, overallStart.plus(Days.ONE)), "2", 2);
View Full Code Here

    Assert.assertTrue(
        "These timestamps have to be at the end AND include now for this test to work.",
        overallStart.isAfter(timeline.incompletePartitionsTimeline.lastEntry().getKey().getEnd())
    );

    final Interval oneHourInterval1 = new Interval(overallStart.plus(Hours.THREE), overallStart.plus(Hours.FOUR));
    final Interval oneHourInterval2 = new Interval(overallStart.plus(Hours.FOUR), overallStart.plus(Hours.FIVE));

    add(oneHourInterval1, "1", 1);
    add(oneHourInterval2, "1", 1);
    add(new Interval(overallStart, overallStart.plus(Days.ONE)), "2", 2);
View Full Code Here

        "These timestamps have to be at the end AND include now for this test to work.",
        overallStart.isAfter(timeline.incompletePartitionsTimeline.lastEntry().getKey().getEnd())
    );

    final Interval oneHourInterval1 = new Interval(overallStart.plus(Hours.THREE), overallStart.plus(Hours.FOUR));
    final Interval oneHourInterval2 = new Interval(overallStart.plus(Hours.FOUR), overallStart.plus(Hours.FIVE));

    add(oneHourInterval1, "1", 1);
    add(oneHourInterval2, "1", 1);
    add(new Interval(overallStart, overallStart.plus(Days.ONE)), "2", 2);
View Full Code Here

        "These timestamps have to be at the end AND include now for this test to work.",
        overallStart.isAfter(timeline.incompletePartitionsTimeline.lastEntry().getKey().getEnd())
    );

    final Interval oneHourInterval1 = new Interval(overallStart.plus(Hours.THREE), overallStart.plus(Hours.FOUR));
    final Interval oneHourInterval2 = new Interval(overallStart.plus(Hours.FOUR), overallStart.plus(Hours.FIVE));

    add(oneHourInterval1, "1", 1);
    add(oneHourInterval2, "1", 1);
    add(new Interval(overallStart, overallStart.plus(Days.ONE)), "2", 2);
View Full Code Here

    final Interval oneHourInterval1 = new Interval(overallStart.plus(Hours.THREE), overallStart.plus(Hours.FOUR));
    final Interval oneHourInterval2 = new Interval(overallStart.plus(Hours.FOUR), overallStart.plus(Hours.FIVE));

    add(oneHourInterval1, "1", 1);
    add(oneHourInterval2, "1", 1);
    add(new Interval(overallStart, overallStart.plus(Days.ONE)), "2", 2);

    assertValues(
        Arrays.asList(
            createExpected(oneHourInterval1.toString(), "2", 2)
        ),
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.