Package org.joda.time

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


    // NB: cannot handle replaying of old logs or going back to the future
    if (date != null) {
      DateTime fixed = date.withYear(year);

      // flume clock is ahead or there is some latency, and the year rolled
      if (fixed.isAfter(now) && fixed.minusMonths(1).isAfter(now)) {
        fixed = date.withYear(year - 1);
      // flume clock is behind and the year rolled
      } else if (fixed.isBefore(now) && fixed.plusMonths(1).isBefore(now)) {
        fixed = date.withYear(year + 1);
      }
View Full Code Here


      case THISWEEK:
        return dt.minusWeeks(1).getMillis();
      case LASTWEEK:
        return dt.minusWeeks(2).getMillis();
      case THISMONTH:
        return dt.minusMonths(1).getMillis();
      case LASTMONTH:
        return dt.minusMonths(2).getMillis();
      case THISYEAR:
        return dt.minusYears(1).getMillis();
      case LASTYEAR:
View Full Code Here

      case LASTWEEK:
        return dt.minusWeeks(2).getMillis();
      case THISMONTH:
        return dt.minusMonths(1).getMillis();
      case LASTMONTH:
        return dt.minusMonths(2).getMillis();
      case THISYEAR:
        return dt.minusYears(1).getMillis();
      case LASTYEAR:
        return dt.minusYears(2).getMillis();
View Full Code Here

      case LASTWEEK:
        return dt.minusWeeks(1).getMillis();
      case THISMONTH:
        return dt.getMillis();
      case LASTMONTH:
        return dt.minusMonths(1).getMillis();
      case THISYEAR:
        return dt.getMillis();
      case LASTYEAR:
        return dt.minusYears(1).getMillis();
View Full Code Here

      DateTime now = new DateTime();
      int year = now.getYear();
      DateTime corrected = date.withYear(year);

      // flume clock is ahead or there is some latency, and the year rolled
      if (corrected.isAfter(now) && corrected.minusMonths(1).isAfter(now)) {
        corrected = date.withYear(year - 1);
      // flume clock is behind and the year rolled
      } else if (corrected.isBefore(now) && corrected.plusMonths(1).isBefore(now)) {
        corrected = date.withYear(year + 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

    // NB: cannot handle replaying of old logs or going back to the future
    if (date != null) {
      DateTime fixed = date.withYear(year);

      // flume clock is ahead or there is some latency, and the year rolled
      if (fixed.isAfter(now) && fixed.minusMonths(1).isAfter(now)) {
        fixed = date.withYear(year - 1);
      // flume clock is behind and the year rolled
      } else if (fixed.isBefore(now) && fixed.plusMonths(1).isBefore(now)) {
        fixed = date.withYear(year + 1);
      }
View Full Code Here

    // NB: cannot handle replaying of old logs or going back to the future
    if (date != null) {
      DateTime fixed = date.withYear(year);

      // flume clock is ahead or there is some latency, and the year rolled
      if (fixed.isAfter(now) && fixed.minusMonths(1).isAfter(now)) {
        fixed = date.withYear(year - 1);
      // flume clock is behind and the year rolled
      } else if (fixed.isBefore(now) && fixed.plusMonths(1).isBefore(now)) {
        fixed = date.withYear(year + 1);
      }
View Full Code Here

            now
        )
    );
    Assert.assertFalse(
        rule.appliesTo(
            builder.interval(new Interval(now.minusMonths(2), now.minusDays(1)))
                       .build(),
            now
        )
    );
  }
View Full Code Here

        // 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

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.