Package org.goda.time

Examples of org.goda.time.DateTime$Property


  @Override
  protected MutableInterval _nextMutableInterval(PointerType pointer) {
    int halfDay = RepeaterDay.DAY_SECONDS / 2;
    int fullDay = RepeaterDay.DAY_SECONDS;

    DateTime now = getNow();
    Tick tick = getType();
    boolean first = false;
    if (_currentTime == null) {
      first = true;
      DateTime midnight = Time.ymd(now);
      DateTime yesterdayMidnight = midnight.minusSeconds(fullDay);
      DateTime tomorrowMidnight = midnight.plusSeconds(fullDay);
      boolean done = false;
      if (pointer == Pointer.PointerType.FUTURE) {
        if (tick.isAmbiguous()) {
          List<DateTime> futureDates = new LinkedList<DateTime>();
          futureDates.add( midnight.plusSeconds(tick.intValue()));
          futureDates.add(midnight.plusSeconds( halfDay + tick.intValue()));
          futureDates.add(tomorrowMidnight.plusSeconds(tick.intValue()));
          for (DateTime futureDate : futureDates) {
            if (futureDate.getMillis() > now.getMillis() || futureDate.equals(now)) {
              _currentTime = futureDate;
              done = true;
              break;
            }
          }
        }
        else {
          List<DateTime> futureDates = new LinkedList<DateTime>();
          futureDates.add(midnight.plusSeconds(tick.intValue()));
          futureDates.add(tomorrowMidnight.plusSeconds(tick.intValue()));
          for (DateTime futureDate : futureDates) {
            if (futureDate.getMillis() > now.getMillis() || futureDate.equals(now)) {
              _currentTime = futureDate;
              done = true;
              break;
View Full Code Here


            if (chrono == null) {
                if (zone == DateTimeZone.UTC) {
                    // First create without a lower limit.
                    chrono = new CopticChronology(null, null, minDaysInFirstWeek);
                    // Impose lower limit and make another CopticChronology.
                    DateTime lowerLimit = new DateTime(1, 1, 1, 0, 0, 0, 0, chrono);
                    chrono = new CopticChronology
                        (LimitChronology.getInstance(chrono, lowerLimit, null),
                         null, minDaysInFirstWeek);
                } else {
                    chrono = getInstance(DateTimeZone.UTC, minDaysInFirstWeek);
View Full Code Here

        if (zone == DateTimeZone.UTC && iWithUTC != null) {
            return iWithUTC;
        }

        DateTime lowerLimit = iLowerLimit;
        if (lowerLimit != null) {
            MutableDateTime mdt = lowerLimit.toMutableDateTime();
            mdt.setZoneRetainFields(zone);
            lowerLimit = mdt.toDateTime();
        }

        DateTime upperLimit = iUpperLimit;
        if (upperLimit != null) {
            MutableDateTime mdt = upperLimit.toMutableDateTime();
            mdt.setZoneRetainFields(zone);
            upperLimit = mdt.toDateTime();
        }
       
        LimitChronology chrono = getInstance
View Full Code Here

        converted.put(field, limitField);
        return limitField;
    }

    void checkLimits(long instant, String desc) {
        DateTime limit;
        if ((limit = iLowerLimit) != null && instant < limit.getMillis()) {
            throw new LimitException(desc, true);
        }
        if ((limit = iUpperLimit) != null && instant >= limit.getMillis()) {
            throw new LimitException(desc, false);
        }
    }
View Full Code Here

    return new MutableInterval(Time.cloneAndAdd(mutableInterval.getStart(), Time.MONTH, (int)(amount * direction)), Time.cloneAndAdd(mutableInterval.getEnd(), Time.MONTH, (int)(amount * direction)));
  }

  @Override
  protected MutableInterval _thisMutableInterval(PointerType pointer) {
    DateTime monthStart;
    DateTime monthEnd;
    if (pointer == PointerType.FUTURE) {
      monthStart = Time.cloneAndAdd(Time.ymd(getNow()), Time.DAY_OF_MONTH, 1);
      monthEnd = Time.cloneAndAdd(Time.ym(getNow()), Time.MONTH, 1);
    }
    else if (pointer == PointerType.PAST) {
View Full Code Here

            if (chrono == null) {
                if (zone == DateTimeZone.UTC) {
                    // First create without a lower limit.
                    chrono = new IslamicChronology(null, null, leapYears);
                    // Impose lower limit and make another IslamicChronology.
                    DateTime lowerLimit = new DateTime(1, 1, 1, 0, 0, 0, 0, chrono);
                    chrono = new IslamicChronology(
                        LimitChronology.getInstance(chrono, lowerLimit, null),
                         null, leapYears);
                } else {
                    chrono = getInstance(DateTimeZone.UTC, leapYears);
View Full Code Here

            if (chrono == null) {
                if (zone == DateTimeZone.UTC) {
                    // First create without a lower limit.
                    chrono = new EthiopicChronology(null, null, minDaysInFirstWeek);
                    // Impose lower limit and make another EthiopicChronology.
                    DateTime lowerLimit = new DateTime(1, 1, 1, 0, 0, 0, 0, chrono);
                    chrono = new EthiopicChronology
                        (LimitChronology.getInstance(chrono, lowerLimit, null),
                         null, minDaysInFirstWeek);
                } else {
                    chrono = getInstance(DateTimeZone.UTC, minDaysInFirstWeek);
View Full Code Here

  public static DateTime construct(int year, int month) {
    if (year <= 1900) {
      throw new IllegalArgumentException("Illegal year '" + year + "'");
    }
    return new DateTime(year, month, 1,0,0,0,0);
  }
View Full Code Here

    _range = createRange(type);
  }

  @Override
  protected MutableInterval _nextMutableInterval(PointerType pointer) {
    DateTime rangeStart;
    DateTime rangeEnd;
    if (_currentMutableInterval == null) {
      long nowSeconds = (getNow().getMillis() - Time.ymd(getNow()).getMillis()) / 1000;
      if (nowSeconds < _range.getBegin()) {
        if (pointer == Pointer.PointerType.FUTURE) {
          rangeStart = Time.cloneAndAdd(Time.ymd(getNow()), Time.SECOND, (int) _range.getBegin());
View Full Code Here

    return _currentMutableInterval;
  }

  @Override
  protected MutableInterval _thisMutableInterval(PointerType pointer) {
    DateTime rangeStart = Time.cloneAndAdd(Time.ymd(getNow()), Time.SECOND, (int) _range.getBegin());
    _currentMutableInterval = new MutableInterval(rangeStart, Time.cloneAndAdd(rangeStart, Time.SECOND,(int) _range.getWidth()));
    return _currentMutableInterval;
  }
View Full Code Here

TOP

Related Classes of org.goda.time.DateTime$Property

Copyright © 2018 www.massapicom. 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.