List of usage examples for org.joda.time TimeOfDay TimeOfDay
public TimeOfDay(int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
ISOChronology
in the default zone. From source file:net.sourceforge.fenixedu.domain.space.EventSpaceOccupation.java
License:Open Source License
protected DateTime getInstant(boolean firstInstant, YearMonthDay begin, final YearMonthDay end, final HourMinuteSecond beginTime, final HourMinuteSecond endTime, final FrequencyType frequency, final DiaSemana diaSemana, final Boolean dailyFrequencyMarkSaturday, final Boolean dailyFrequencyMarkSunday) { DateTime instantResult = null;//from ww w . j av a2s .c om begin = getBeginDateInSpecificWeekDay(diaSemana, begin); if (frequency == null) { if (!begin.isAfter(end)) { if (firstInstant) { return begin.toDateTime(new TimeOfDay(beginTime.getHour(), beginTime.getMinuteOfHour(), 0, 0)); } else { return end.toDateTime(new TimeOfDay(endTime.getHour(), endTime.getMinuteOfHour(), 0, 0)); } } } else { int numberOfDaysToSum = frequency.getNumberOfDays(); while (true) { if (begin.isAfter(end)) { break; } DateTime intervalEnd = begin .toDateTime(new TimeOfDay(endTime.getHour(), endTime.getMinuteOfHour(), 0, 0)); if (!frequency.equals(FrequencyType.DAILY) || ((dailyFrequencyMarkSaturday || intervalEnd.getDayOfWeek() != SATURDAY_IN_JODA_TIME) && (dailyFrequencyMarkSunday || intervalEnd.getDayOfWeek() != SUNDAY_IN_JODA_TIME))) { if (firstInstant) { return begin .toDateTime(new TimeOfDay(beginTime.getHour(), beginTime.getMinuteOfHour(), 0, 0)); } else { instantResult = intervalEnd; } } begin = begin.plusDays(numberOfDaysToSum); } } return instantResult; }
From source file:net.sourceforge.fenixedu.domain.space.EventSpaceOccupation.java
License:Open Source License
protected static Interval createNewInterval(YearMonthDay begin, YearMonthDay end, HourMinuteSecond beginTime, HourMinuteSecond endTime) {/* w ww .j av a2 s. co m*/ return new Interval(begin.toDateTime(new TimeOfDay(beginTime.getHour(), beginTime.getMinuteOfHour(), 0, 0)), end.toDateTime(new TimeOfDay(endTime.getHour(), endTime.getMinuteOfHour(), 0, 0))); }
From source file:net.sourceforge.fenixedu.domain.Summary.java
License:Open Source License
public DateTime getSummaryDateTime() { HourMinuteSecond time = getSummaryHourHourMinuteSecond(); return getSummaryDateYearMonthDay() .toDateTime(new TimeOfDay(time.getHour(), time.getMinuteOfHour(), time.getSecondOfMinute(), 0)); }