Examples of toPeriod()


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

            }
            return;
        }


        p = interval.toPeriod(PeriodType.days());
        n = p.getDays();
        unitSize = (int) (settings.graduations.fontMetrics.getStringBounds("30", null)).getWidth();
        if (n < (width / unitSize)) {
            //System.out.println("j");
            for (int i = 0; i < n; i++) {
View Full Code Here

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

                        Hours.hoursBetween(dtFrom.plusDays(i), dtFrom.plusDays(i + 1)).getHours());
            }
            return;
        }

        p = interval.toPeriod(PeriodType.months());
        n = p.getMonths();
        unitSize = (int) (settings.graduations.fontMetrics.getStringBounds("September  ", null)).getWidth();
        if (n < (width / unitSize)) {
            //System.out.println("mois");
            for (int i = 0; i < n; i++) {
View Full Code Here

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

                        Days.daysBetween(dtFrom.plusMonths(i), dtFrom.plusMonths(i + 1)).getDays());
            }
            return;
        }

        p = interval.toPeriod(PeriodType.years());
        n = p.getYears();
        unitSize = (int) (settings.graduations.fontMetrics.getStringBounds("1980 ", null)).getWidth();
        if (n < (width / unitSize)) {
            //System.out.println("year");
            for (int i = 0; i < n; i++) {
View Full Code Here

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

    }
  }

  public static String elapsedTime(Date d1, Date d2){
    Interval interval = new Interval(d1.getTime(), d2.getTime());
    Period period = interval.toPeriod();
    return period.getDays() + " days, " + period.getHours()+" hours, " + period.getMinutes()  +" minutes, " +period.getSeconds()+" seconds";
  }


  public static void main(String[] args) {
View Full Code Here

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

    ReadablePeriod duration = null;
    if (startingTime == null || finishingTime == null) {
      duration = new Period();
    } else {
      Interval intervallTime = new Interval(startingTime, finishingTime);
      duration = intervallTime.toPeriod();
    }

    return duration;
  }
 
View Full Code Here

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

        AcademicCalendarEntry entryByInstant =
                academicCalendar.getEntryByInstant(instant, AcademicSemesterCE.class, AcademicYearCE.class);
        if (entryByInstant != null) {
            DateTime instantDateTime = new DateTime(instant);
            Interval interval = new Interval(entryByInstant.getBegin(), instantDateTime);
            int days = interval.toPeriod().getDays();
            if (days > 0) {
                return days;
            }
        }
        return 0;
View Full Code Here

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

        final DateMidnight firstMonday = beginningOfLessonPeriod.withField(DateTimeFieldType.dayOfWeek(), 1);
        final DateMidnight thisMonday = new DateMidnight().withField(DateTimeFieldType.dayOfWeek(), 1);

        final Interval interval = new Interval(firstMonday, thisMonday);

        return interval.toPeriod(PeriodType.weeks()).getWeeks();
    }

    public Set<WeeklyWorkLoad> getSortedWeeklyWorkLoads() {
        return new TreeSet<WeeklyWorkLoad>(getWeeklyWorkLoadsSet());
    }
View Full Code Here

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

                    truncatedInterval = interval.withEnd(now);
                }
            }

            // Truncate start
            if (truncatedInterval.toPeriod(type).getValue(0) > --limit) {
                Period limitPeriod = period(limit, type);
                DateTime truncatedStart = truncatedInterval.getEnd().minus(limitPeriod);
                truncatedInterval = truncatedInterval.withStart(truncatedStart);
            }
        }
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.