Package org.goda.time

Examples of org.goda.time.DateTime


                    // Use pivots which are compatible with SimpleDateFormat.
                    switch (c) {
                    case 'x':
                        builder.appendTwoDigitWeekyear
                            (new DateTime().getWeekyear() - 30, lenientParse);
                        break;
                    case 'y':
                    case 'Y':
                    default:
                        builder.appendTwoDigitYear(new DateTime().getYear() - 30, lenientParse);
                        break;
                    }
                } else {
                    // Try to support long year values.
                    int maxDigits = 9;
View Full Code Here


                        p.getYears() == 0 && p.getMonths() > 4 && p.getMonths() < 8 &&
                        curNameKey.equals(zoneNameData[2]) &&
                        curNameKey.equals(zoneNameData[4])) {
                   
                    System.out.println("Fixing duplicate name key - " + nextNameKey);
                    System.out.println("     - " + new DateTime(trans[i]) + " - " + new DateTime(trans[i + 1]));
                    if (curOffset > nextOffset) {
                        nameKeys[i] = (curNameKey + "-Summer").intern();
                    } else if (curOffset < nextOffset) {
                        nameKeys[i + 1] = (nextNameKey + "-Summer").intern();
                        i++;
View Full Code Here

        BuddhistChronology chrono = (BuddhistChronology) cCache.get(zone);
        if (chrono == null) {
            // First create without a lower limit.
            chrono = new BuddhistChronology(GJChronology.getInstance(zone, null), null);
            // Impose lower limit and make another BuddhistChronology.
            DateTime lowerLimit = new DateTime(1, 1, 1, 0, 0, 0, 0, chrono);
            chrono = new BuddhistChronology(LimitChronology.getInstance(chrono, lowerLimit, null), "");
            cCache.put(zone, chrono);
        }
        return chrono;
    }
View Full Code Here

  private boolean _debug;
  private int _ambiguousTimeRange;
  private boolean _compatibilityMode;

  public Options() {
    this(Pointer.PointerType.FUTURE, new DateTime(), true, 6);
  }
View Full Code Here

  public Options(DateTime now, boolean guess) {
    this(Pointer.PointerType.FUTURE, now, guess, 6);
  }

  public Options(Pointer.PointerType context) {
    this(context,new DateTime(), true, 6);
  }
View Full Code Here

  public Options(Pointer.PointerType context) {
    this(context,new DateTime(), true, 6);
  }

  public Options(boolean guess) {
    this(Pointer.PointerType.FUTURE, new DateTime(), guess, 6);
  }
View Full Code Here

  public Options(boolean guess) {
    this(Pointer.PointerType.FUTURE, new DateTime(), guess, 6);
  }

  public Options(int ambiguousTimeRange) {
    this(Pointer.PointerType.FUTURE, new DateTime(), true, ambiguousTimeRange);
  }
View Full Code Here

  @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

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.