Package org.joda.time

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


    ObjectNode event = JOM.createObjectNode();
   
    if (start == null) {
      // set start to current time, rounded to hours
      DateTime startDate = DateTime.now();
      startDate = startDate.plusHours(1);
      startDate = startDate.minusMinutes(startDate.getMinuteOfHour());
      startDate = startDate.minusSeconds(startDate.getSecondOfMinute());
      startDate = startDate.minusMillis(startDate.getMillisOfSecond());
      start = startDate.toString();
    }
View Full Code Here


    ObjectNode event = JOM.createObjectNode();
   
    if (start == null) {
      // set start to current time, rounded to hours
      DateTime startDate = DateTime.now();
      startDate = startDate.plusHours(1);
      startDate = startDate.minusMinutes(startDate.getMinuteOfHour());
      startDate = startDate.minusSeconds(startDate.getSecondOfMinute());
      startDate = startDate.minusMillis(startDate.getMillisOfSecond());
      start = startDate.toString();
    }
View Full Code Here

                    } else if (endTimeStamp == 0) {
                        DateTime time = new DateTime(timeStamp);
                        statusMsg += " begin read at " + time.toString();
                        context.setStatus(statusMsg);
                        log.info(key.getTopic() + " begin read at " + time.toString());
                        endTimeStamp = (time.plusHours(this.maxPullHours)).getMillis();
                    } else if (timeStamp > endTimeStamp || System.currentTimeMillis() > maxPullTime) {
                        if (timeStamp > endTimeStamp)
                            log.info("Kafka Max history hours reached");
                        if (System.currentTimeMillis() > maxPullTime)
                            log.info("Kafka pull time limit reached");
View Full Code Here

        ObjectNode event = JOM.createObjectNode();

        if (start == null) {
            // set start to current time, rounded to hours
            DateTime startDate = DateTime.now();
            startDate = startDate.plusHours(1);
            startDate = startDate.minusMinutes(startDate.getMinuteOfHour());
            startDate = startDate.minusSeconds(startDate.getSecondOfMinute());
            startDate = startDate.minusMillis(startDate.getMillisOfSecond());
            start = startDate.toString();
        }
View Full Code Here

        DateTime dateTime = new DateTime(2001, 1, 22, 3, 4, 5, 321, DateTimeZone.UTC);
        long seconds = getSeconds(dateTime);

        assertFunction("date_add('second', 3, " + seconds + ")", getSeconds(dateTime.plusSeconds(3)));
        assertFunction("date_add('minute', 3, " + seconds + ")", getSeconds(dateTime.plusMinutes(3)));
        assertFunction("date_add('hour', 3, " + seconds + ")", getSeconds(dateTime.plusHours(3)));
        assertFunction("date_add('day', 3, " + seconds + ")", getSeconds(dateTime.plusDays(3)));
        assertFunction("date_add('week', 3, " + seconds + ")", getSeconds(dateTime.plusWeeks(3)));
        assertFunction("date_add('month', 3, " + seconds + ")", getSeconds(dateTime.plusMonths(3)));
        assertFunction("date_add('quarter', 3, " + seconds + ")", getSeconds(dateTime.plusMonths(3 * 3)));
        assertFunction("date_add('year', 3, " + seconds + ")", getSeconds(dateTime.plusYears(3)));
View Full Code Here

    public void time()
    {
        DateTime startDate = new DateTime().dayOfMonth().withMinimumValue();
        DateTime endDate = new DateTime().dayOfMonth().withMaximumValue();
        Activity start = td.newActivity(startDate, startDate.plusHours(1));
        Activity end = td.newActivity(endDate, endDate.plusHours(1));

        Day cut = new Day();
        assertNull(cut.getStart());
        assertNull(cut.getEnd());
        cut.add(start);
View Full Code Here

    public void time()
    {
        DateTime startDate = new DateTime().dayOfMonth().withMinimumValue().plusDays(5);
        DateTime endDate = new DateTime().dayOfMonth().withMaximumValue().minusDays(5);
        Activity start = td.newActivity(startDate, startDate.plusHours(1));
        Activity end = td.newActivity(endDate, endDate.plusHours(1));

        Week cut = new Week();
        assertNull(cut.getStart());
        assertNull(cut.getEnd());
        cut.add(start);
View Full Code Here

    @Test
    public void matchingRange()
    {
        Activity activity = td.newActivity();
        DateTime date = new DateTime().minusYears(1);
        Activity lastYear = td.newActivity(date, date.plusHours(1));

        // empty
        Activities cut = td.newActivities(WEEK);
        assertTrue(cut.matchingRange(activity));
        assertFalse(cut.matchingRange(lastYear));
View Full Code Here

        // month
        DateTime startDate = new DateTime().dayOfMonth().withMinimumValue().plusDays(5);
        DateTime endDate = new DateTime().dayOfMonth().withMaximumValue().minusDays(5);
        Activity start = td.newActivity(startDate, startDate.plusHours(1));
        Activity end = td.newActivity(endDate, endDate.plusHours(1));
        internalGetStartEnd(td.month(), start, end);

        // week
        startDate = new DateTime().dayOfWeek().withMinimumValue();
        endDate = new DateTime().dayOfWeek().withMaximumValue();
View Full Code Here

        // week
        startDate = new DateTime().dayOfWeek().withMinimumValue();
        endDate = new DateTime().dayOfWeek().withMaximumValue();
        start = td.newActivity(startDate, startDate.plusHours(1));
        end = td.newActivity(endDate, endDate.plusHours(1));
        internalGetStartEnd(td.week(), start, end);

        // day
        startDate = new DateTime().hourOfDay().withMinimumValue();
        endDate = new DateTime().hourOfDay().withMaximumValue().minusHours(1);
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.