Examples of MutableDateTime


Examples of org.joda.time.MutableDateTime

    LocalDate end = new LocalDate();
    LocalDate start = end.minusYears(1);

    List<File> result = new ArrayList<File>();
    IPath[] storagePaths = XmlPlugin.getDefault().getStoragePaths();
    MutableDateTime date = start.toDateTime(new LocalTime(0, 0, 0)).toMutableDateTime();
    while (new LocalDate(date.toInstant().getMillis()).compareTo(end) <= 0) {

      for (IPath path : storagePaths) {
        File f = store.getDataFile(new LocalDate(date.getMillis()), path);
        if (f.exists()) {
          result.add(f);
        }
      }
      date.addMonths(1);
    }
    assertEquals(result.size(), store.getDataFiles(start, end).size());
  }
View Full Code Here

Examples of org.joda.time.MutableDateTime

      int day = cal.get(Calendar.DAY_OF_MONTH);
      int hours = (hoursInput == null ? 0 : hoursInput % 24);
      int minutes = (minutesInput == null ? 0 : minutesInput);

      // Use the input to create a date object with proper timezone
      MutableDateTime date = new MutableDateTime(year, month, day, hours, minutes, 0, 0,
        DateTimeZone.forTimeZone(getClientTimeZone()));

      // Adjust for halfday if needed
      if (use12HourFormat())
      {
        int halfday = (amOrPmInput == AM_PM.PM ? 1 : 0);
        date.set(DateTimeFieldType.halfdayOfDay(), halfday);
        date.set(DateTimeFieldType.hourOfHalfday(), hours % 12);
      }

      // The date will be in the server's timezone
      setConvertedInput(new Date(date.getMillis()));
    }
    catch (RuntimeException e)
    {
      DateTimeField.this.error(e.getMessage());
      invalid();
View Full Code Here

Examples of org.joda.time.MutableDateTime

      if (zone != null)
      {
        modelObject = changeTimeZone(modelObject, zone);
      }

      MutableDateTime mDate = new MutableDateTime(modelObject);

      date = mDate.toDate();

      if (use12HourFormat)
      {
        int hourOfHalfDay = mDate.get(DateTimeFieldType.hourOfHalfday());
        hours = hourOfHalfDay == 0 ? 12 : hourOfHalfDay;
      }
      else
      {
        hours = mDate.get(DateTimeFieldType.hourOfDay());
      }

      amOrPm = (mDate.get(DateTimeFieldType.halfdayOfDay()) == 0) ? AM_PM.AM : AM_PM.PM;
      minutes = mDate.getMinuteOfHour();
    }

    super.onBeforeRender();
  }
View Full Code Here

Examples of org.joda.time.MutableDateTime

      int day = cal.get(Calendar.DAY_OF_MONTH);
      int hours = (hoursInput == null ? 0 : hoursInput % 24);
      int minutes = (minutesInput == null ? 0 : minutesInput);

      // Use the input to create a date object with proper timezone
      MutableDateTime date = new MutableDateTime(year, month, day, hours, minutes, 0, 0,
        DateTimeZone.forTimeZone(getClientTimeZone()));

      // Adjust for halfday if needed
      if (use12HourFormat())
      {
        int halfday = (amOrPmInput == AM_PM.PM ? 1 : 0);
        date.set(DateTimeFieldType.halfdayOfDay(), halfday);
        date.set(DateTimeFieldType.hourOfHalfday(), hours % 12);
      }

      // The date will be in the server's timezone
      setConvertedInput(newDateInstance(date.getMillis()));
    }
    catch (RuntimeException e)
    {
      DateTimeField.this.error(e.getMessage());
      invalid();
View Full Code Here

Examples of org.joda.time.MutableDateTime

      hours = null;
      minutes = null;
    }
    else
    {
      MutableDateTime mDate = new MutableDateTime(modelObject);
      // convert date to the client's time zone if we have that info
      TimeZone zone = getClientTimeZone();
      if (zone != null)
      {
        mDate.setZone(DateTimeZone.forTimeZone(zone));
      }

      date = mDate.toDateTime().toLocalDate().toDate();

      if (use12HourFormat)
      {
        int hourOfHalfDay = mDate.get(DateTimeFieldType.hourOfHalfday());
        hours = hourOfHalfDay == 0 ? 12 : hourOfHalfDay;
      }
      else
      {
        hours = mDate.get(DateTimeFieldType.hourOfDay());
      }

      amOrPm = (mDate.get(DateTimeFieldType.halfdayOfDay()) == 0) ? AM_PM.AM : AM_PM.PM;
      minutes = mDate.getMinuteOfHour();
    }

    super.onBeforeRender();
  }
View Full Code Here

Examples of org.joda.time.MutableDateTime

      int day = cal.get(Calendar.DAY_OF_MONTH);
      int hours = (hoursInput == null ? 0 : hoursInput % 24);
      int minutes = (minutesInput == null ? 0 : minutesInput);

      // Use the input to create a date object with proper timezone
      MutableDateTime date = new MutableDateTime(year, month, day, hours, minutes, 0, 0,
        DateTimeZone.forTimeZone(getClientTimeZone()));

      // Adjust for halfday if needed
      if (use12HourFormat())
      {
        int halfday = (amOrPmInput == AM_PM.PM ? 1 : 0);
        date.set(DateTimeFieldType.halfdayOfDay(), halfday);
        date.set(DateTimeFieldType.hourOfHalfday(), hours % 12);
      }

      // The date will be in the server's timezone
      setConvertedInput(newDateInstance(date.getMillis()));
    }
    catch (RuntimeException e)
    {
      DateTimeField.this.error(e.getMessage());
      invalid();
View Full Code Here

Examples of org.joda.time.MutableDateTime

      hours = null;
      minutes = null;
    }
    else
    {
      MutableDateTime mDate = new MutableDateTime(modelObject);
      // convert date to the client's time zone if we have that info
      TimeZone zone = getClientTimeZone();
      if (zone != null)
      {
        mDate.setZone(DateTimeZone.forTimeZone(zone));
      }

      date = mDate.toDateTime().toLocalDate().toDate();

      if (use12HourFormat)
      {
        int hourOfHalfDay = mDate.get(DateTimeFieldType.hourOfHalfday());
        hours = hourOfHalfDay == 0 ? 12 : hourOfHalfDay;
      }
      else
      {
        hours = mDate.get(DateTimeFieldType.hourOfDay());
      }

      amOrPm = (mDate.get(DateTimeFieldType.halfdayOfDay()) == 0) ? AM_PM.AM : AM_PM.PM;
      minutes = mDate.getMinuteOfHour();
    }

    super.onBeforeRender();
  }
View Full Code Here

Examples of org.joda.time.MutableDateTime

      int day = cal.get(Calendar.DAY_OF_MONTH);
      int hours = (hoursInput == null ? 0 : hoursInput % 24);
      int minutes = (minutesInput == null ? 0 : minutesInput);

      // Use the input to create a date object with proper timezone
      MutableDateTime date = new MutableDateTime(year, month, day, hours, minutes, 0, 0,
        DateTimeZone.forTimeZone(getClientTimeZone()));

      // Adjust for halfday if needed
      if (use12HourFormat())
      {
        int halfday = (amOrPmInput == AM_PM.PM ? 1 : 0);
        date.set(DateTimeFieldType.halfdayOfDay(), halfday);
        date.set(DateTimeFieldType.hourOfHalfday(), hours % 12);
      }

      // The date will be in the server's timezone
      setConvertedInput(newDateInstance(date.getMillis()));
    }
    catch (RuntimeException e)
    {
      DateTimeField.this.error(e.getMessage());
      invalid();
View Full Code Here

Examples of org.joda.time.MutableDateTime

      hours = null;
      minutes = null;
    }
    else
    {
      MutableDateTime mDate = new MutableDateTime(modelObject);
      // convert date to the client's time zone if we have that info
      TimeZone zone = getClientTimeZone();
      if (zone != null)
      {
        mDate.setZone(DateTimeZone.forTimeZone(zone));
      }

      date = mDate.toDateTime().toLocalDate().toDate();

      if (use12HourFormat)
      {
        int hourOfHalfDay = mDate.get(DateTimeFieldType.hourOfHalfday());
        hours = hourOfHalfDay == 0 ? 12 : hourOfHalfDay;
      }
      else
      {
        hours = mDate.get(DateTimeFieldType.hourOfDay());
      }

      amOrPm = (mDate.get(DateTimeFieldType.halfdayOfDay()) == 0) ? AM_PM.AM : AM_PM.PM;
      minutes = mDate.getMinuteOfHour();
    }

    super.onBeforeRender();
  }
View Full Code Here

Examples of org.joda.time.MutableDateTime

    //------------------------------------------------------------------------
   
    private void checkJodaSetYear() {
        int COUNT = COUNT_FAST;
        // Is it fair to use only MutableDateTime here? You decide.
        MutableDateTime dt = new MutableDateTime(GJChronology.getInstance());
        for (int i = 0; i < AVERAGE; i++) {
            start("Joda", "setYear");
            for (int j = 0; j < COUNT; j++) {
                dt.setYear(1972);
                if (dt == null) {System.out.println("Anti optimise");}
            }
            end(COUNT);
        }
    }
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.