Package org.joda.time

Examples of org.joda.time.LocalTime


       
        return true;
    }
   
    private boolean isCorrectHourOfDay(DateTime time) {
        LocalTime alertTime = new LocalTime(time.getHourOfDay(), time.getMinuteOfHour());
        return alertTime.isAfter(getFromTime()) && alertTime.isBefore(getToTime());
    }
View Full Code Here


    private DateTime dateTime(String time) {
        return new DateTime(2012, 01, 01, Integer.valueOf(time.substring(0, 2)), Integer.valueOf(time.substring(2)));
    }
   
    private LocalTime localTime(String time) {
        return new LocalTime(Integer.valueOf(time.substring(0, 2)), Integer.valueOf(time.substring(2)));
    }
View Full Code Here

    public ActionForward search(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        final DynaActionForm dynaActionForm = (DynaActionForm) form;

        final LocalDate day = getDate(dynaActionForm);
        LocalTime begin = getTimeDateFromForm(dynaActionForm, "beginningHour", "beginningMinute");
        if (begin == null) {
            begin = new LocalTime(0, 0, 0);
        }
        LocalTime end = getTimeDateFromForm(dynaActionForm, "endHour", "endMinute");
        if (end == null) {
            end = new LocalTime(23, 59, 59);
        }

        return search(mapping, request, day, begin, end, dynaActionForm);
    }
View Full Code Here

        final String day = date.substring(8, 10);
        dynaActionForm.set("year", year);
        dynaActionForm.set("month", month);
        dynaActionForm.set("day", day);

        final LocalTime begin;
        if (selectedBegin != null && selectedBegin.length() > 0) {
            final String hour = selectedBegin.substring(0, 2);
            final String minute = selectedBegin.substring(3, 5);
            dynaActionForm.set("beginningHour", hour);
            dynaActionForm.set("beginningMinute", minute);
            begin = getTimeDateFromForm(hour, minute);
        } else {
            begin = new LocalTime(0, 0, 0);
        }
        final LocalTime end;
        if (selectedEnd != null && selectedEnd.length() > 0) {
            final String hour = selectedEnd.substring(0, 2);
            final String minute = selectedEnd.substring(3, 5);
            dynaActionForm.set("endHour", selectedEnd.substring(0, 2));
            dynaActionForm.set("endMinute", selectedEnd.substring(3, 5));
            end = getTimeDateFromForm(hour, minute);
        } else {
            end = new LocalTime(23, 59, 59);
        }

        final LocalDate localDate = new LocalDate(Integer.parseInt(year), Integer.parseInt(month), Integer.parseInt(day));

        return search(mapping, request, localDate, begin, end, dynaActionForm);
View Full Code Here

        return hourString == null || hourString.isEmpty() || minuteString == null || minuteString.isEmpty() ? null : getTimeDateFromForm(
                hourString, minuteString);
    }

    private LocalTime getTimeDateFromForm(final String hourString, final String minuteString) throws ParseException {
        return new LocalTime(Integer.parseInt(hourString), Integer.parseInt(minuteString), 0);
    }
View Full Code Here

        if (!wasFinished()) {
            YearMonthDay startDateToSearch = getLessonStartDay();
            YearMonthDay endDateToSearch = getLessonEndDay();
            for (YearMonthDay day : getAllValidLessonDatesWithoutInstancesDates(startDateToSearch, endDateToSearch)) {
                intervals.add(new Interval(day.toLocalDate().toDateTime(
                        new LocalTime(getBeginHourMinuteSecond().getHour(), getBeginHourMinuteSecond().getMinuteOfHour(),
                                getBeginHourMinuteSecond().getSecondOfMinute())), day.toLocalDate().toDateTime(
                        new LocalTime(getEndHourMinuteSecond().getHour(), getEndHourMinuteSecond().getMinuteOfHour(),
                                getEndHourMinuteSecond().getSecondOfMinute()))));
            }
        }
        return intervals;
    }
View Full Code Here

            private DateTime toDateTime(Calendar date, Calendar time) {
                if (date == null || time == null) {
                    return new DateTime((Calendar) null);
                }
                return new DateTime(date.getTimeInMillis()).withFields(new LocalTime(time.getTimeInMillis()));
            }
View Full Code Here

     * Converts this object to a LocalTime.
     *
     * @return the LocalTime instance
     */
    public LocalTime toLocalTime() {
        return new LocalTime(getHour(), getMinuteOfHour(), getSecondOfMinute());
    }
View Full Code Here

                    jp.nextToken(); // END_ARRAY?
                }
                if (jp.getCurrentToken() != JsonToken.END_ARRAY) {
                    throw ctxt.wrongTokenException(jp, JsonToken.END_ARRAY, "after LocalTime ints");
                }
                return new LocalTime(hour, minute, second, millis);
            }
            break;
        case VALUE_NUMBER_INT:
            return new LocalTime(jp.getLongValue());           
        case VALUE_STRING:
            String str = jp.getText().trim();
            if (str.length() == 0) { // [JACKSON-360]
                return null;
            }
View Full Code Here

    LocalDateTime ldt = new LocalDateTime(value.getTime());
    return ldt;
  }
 
  public static LocalTime jodaLocalTime(Date value) {
    LocalTime time = new LocalTime(value.getTime());
    return time;
  }
View Full Code Here

TOP

Related Classes of org.joda.time.LocalTime

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.