Examples of toPeriod()


Examples of org.joda.time.Duration.toPeriod()

  public void testSpanTwoDaysOfOfficHoursA() {
    DateTime lastCalculated = new DateTime(2009, 6, 22, 9, 5, 0, 0);
    DateTime now = new DateTime(2009, 6, 24, 9, 5, 0, 0);

    Duration elapsedTime = calculator.calculateElapsedTime(lastCalculated, now, SLAWorkingHours.OFFICE_HOURS_9_TO_5_30);
    Assert.assertEquals("PT17H", elapsedTime.toPeriod().toString());
  }

  public void testSpanTwoDaysOfOfficeHoursB() {
    DateTime lastCalculated = new DateTime(2009, 6, 22, 12, 5, 0, 0);
    DateTime now = new DateTime(2009, 6, 24, 9, 5, 0, 0);
View Full Code Here

Examples of org.joda.time.Duration.toPeriod()

  public void testSpanTwoDaysOfOfficeHoursB() {
    DateTime lastCalculated = new DateTime(2009, 6, 22, 12, 5, 0, 0);
    DateTime now = new DateTime(2009, 6, 24, 9, 5, 0, 0);

    Duration elapsedTime = calculator.calculateElapsedTime(lastCalculated, now, SLAWorkingHours.OFFICE_HOURS_9_TO_5_30);
    Assert.assertEquals("PT14H", elapsedTime.toPeriod().toString());
  }

  public void testSpanTwoDaysOfOfficeHoursC() {
    DateTime lastCalculated = new DateTime(2009, 6, 22, 7, 0, 0, 0);
    DateTime now = new DateTime(2009, 6, 23, 19, 0, 0, 0);
View Full Code Here

Examples of org.joda.time.Duration.toPeriod()

  public void testSpanTwoDaysOfOfficeHoursC() {
    DateTime lastCalculated = new DateTime(2009, 6, 22, 7, 0, 0, 0);
    DateTime now = new DateTime(2009, 6, 23, 19, 0, 0, 0);

    Duration elapsedTime = calculator.calculateElapsedTime(lastCalculated, now, SLAWorkingHours.OFFICE_HOURS_9_TO_5_30);
    Assert.assertEquals("PT17H", elapsedTime.toPeriod().toString());
  }

  public void testSpanTwoDaysOfOfficePlusWeekendHours() {
    DateTime lastCalculated = new DateTime(2009, 6, 19, 7, 0, 0, 0);
    DateTime now = new DateTime(2009, 6, 22, 19, 0, 0, 0);
View Full Code Here

Examples of org.joda.time.Duration.toPeriod()

  public void testSpanTwoDaysOfOfficePlusWeekendHours() {
    DateTime lastCalculated = new DateTime(2009, 6, 19, 7, 0, 0, 0);
    DateTime now = new DateTime(2009, 6, 22, 19, 0, 0, 0);

    Duration elapsedTime = calculator.calculateElapsedTime(lastCalculated, now, SLAWorkingHours.OFFICE_HOURS_9_TO_5_30);
    Assert.assertEquals("PT17H", elapsedTime.toPeriod().toString());
  }

  public void testSpanWeekendAndBankHoliday() {
    DateTime lastCalculated = new DateTime(2008, 12, 31, 7, 0, 0, 0);
    DateTime now = new DateTime(2009, 1, 5, 19, 0, 0, 0);
View Full Code Here

Examples of org.joda.time.Duration.toPeriod()

  public void testSpanWeekendAndBankHoliday() {
    DateTime lastCalculated = new DateTime(2008, 12, 31, 7, 0, 0, 0);
    DateTime now = new DateTime(2009, 1, 5, 19, 0, 0, 0);

    Duration elapsedTime = calculator.calculateElapsedTime(lastCalculated, now, SLAWorkingHours.OFFICE_HOURS_9_TO_5_30);
    Assert.assertEquals("PT25H30M", elapsedTime.toPeriod().toString());
  }

  public void testOutOfOfficeHours() {
    DateTime lastCalculated = new DateTime(2009, 6, 19, 19, 0, 0, 0);
    DateTime now = new DateTime(2009, 6, 19, 21, 0, 0, 0);
View Full Code Here

Examples of org.joda.time.Duration.toPeriod()

                .appendSeconds()
                .appendSuffix(" seconds, ")
                .appendMillis()
                .appendSuffix("ms")
                .toFormatter();
        log.info(periodFormatter.print(duration.toPeriod()));
    }
}
View Full Code Here

Examples of org.joda.time.Duration.toPeriod()

        return timeTaken;
    }

    public String getDisplayTimeTaken() {
        Duration duration = new Duration(timeTaken);
        return JodaTimeFormatter.format(duration.toPeriod());
    }

    public void setTimeTaken(long timeTaken) {
        this.timeTaken = timeTaken;
    }
View Full Code Here

Examples of org.joda.time.Duration.toPeriod()

        if (to == null || from == null || to.isBefore(from)) {
            return "n/a";
        }

        Duration duration = new Duration(from, to);
        Period period = duration.toPeriod();
        return format(period);
    }

    public String getLastFireTimeFormatted() {
        DateTime lastFireTimeAsDate = getLastFireTimeAsDate();
View Full Code Here

Examples of org.joda.time.Duration.toPeriod()

    }

    private String convert(long runningDurationMillis) {
        Duration duration = new Duration(runningDurationMillis);
        PeriodFormatter formatter = PeriodFormat.getDefault();
        return formatter.print(duration.toPeriod());
    }

    private void addDetailsForChildren(JsonObject json, List<? extends IExecutionNode> childNodes) {

        JsonArray children = new JsonArray();
View Full Code Here

Examples of org.joda.time.Interval.toPeriod()

        // TODO take these from the model


        Interval interval = new Interval(dtFrom, dtTo);

        Period p = interval.toPeriod(PeriodType.days());
        // try to determine length if we had to show milliseconds

        int n = p.getDays();
        int unitSize = (int) (settings.graduations.fontMetrics.getStringBounds("wednesday  ", null)).getWidth();
        if (n < (width / unitSize)) {
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.