Package org.goda.time

Examples of org.goda.time.DateTime


        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

    }
    return new DateTime(year, month, 1,0,0,0,0);
  }

  public static DateTime construct(int year, int month, int day) {
    return new DateTime(year, month, day,0,0,0,0);
  }
View Full Code Here

  public static DateTime construct(int year, int month, int day) {
    return new DateTime(year, month, day,0,0,0,0);
  }

  public static DateTime construct(int year, int month, int day, int hour) {
    return new DateTime(year, month, day, hour,0,0,0);
  }
View Full Code Here

  public static DateTime construct(int year, int month, int day, int hour) {
    return new DateTime(year, month, day, hour,0,0,0);
  }

  public static DateTime construct(int year, int month, int day, int hour, int minute) {
    return new DateTime(year, month, day,hour,minute,0,0);
  }
View Full Code Here

TOP

Related Classes of org.goda.time.DateTime

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.