List of usage examples for org.joda.time LocalDateTime getDayOfMonth
public int getDayOfMonth()
From source file:todolist.ui.controllers.SettingsController.java
/** * isWithinWeek//from w ww. j a va 2 s . c o m * * @param startOfWeek * @param endOfWeek * @param endTime * @return boolean */ private boolean isWithinWeek(LocalDateTime startOfWeek, LocalDateTime endOfWeek, java.time.LocalDateTime endTime) { int millis = 0; int seconds = endTime.getSecond(); int minutes = endTime.getMinute(); int hours = endTime.getHour(); int day = endTime.getDayOfMonth(); int month = endTime.getMonthValue(); int year = endTime.getYear(); LocalDateTime endTimeFormatted = new LocalDateTime(); endTimeFormatted = endTimeFormatted.withDate(year, month, day); endTimeFormatted = endTimeFormatted.withTime(hours, minutes, seconds, millis); return endTimeFormatted.isAfter(startOfWeek) && endTimeFormatted.isBefore(endOfWeek); }
From source file:uk.co.onehp.trickle.services.betfair.ScheduledServiceImpl.java
License:Open Source License
private String nextBetSchedule() { LocalDateTime nextBetTime = this.domainService.getNextBetTime(); if (null == nextBetTime) { nextBetTime = new LocalDateTime().plusMinutes(1); }/*ww w . j a v a 2 s .c o m*/ String cron = String.format("%s %s %s %s %s ?", nextBetTime.getSecondOfMinute(), nextBetTime.getMinuteOfHour(), nextBetTime.getHourOfDay(), nextBetTime.getDayOfMonth(), nextBetTime.getMonthOfYear()); return cron; }
From source file:uk.co.onehp.trickle.services.betfair.ScheduledServiceImpl.java
License:Open Source License
private String nextBetPriceSchedule() { LocalDateTime nextBetTime = this.domainService.getNextBetTime(); if (null == nextBetTime) { nextBetTime = new LocalDateTime().plusMinutes(1); } else {/* ww w .j a v a 2 s. c o m*/ nextBetTime = nextBetTime.minusSeconds(this.upcomingBetsSeconds); } String cron = String.format("%s %s %s %s %s ?", nextBetTime.getSecondOfMinute(), nextBetTime.getMinuteOfHour(), nextBetTime.getHourOfDay(), nextBetTime.getDayOfMonth(), nextBetTime.getMonthOfYear()); return cron; }
From source file:view.popups.AssignRoomsPopup.java
@Override public void display(String title) { cBDateTimeStart = new ComboBox(); cBDateTimeEnd = new ComboBox(); assignRooms = new PopupMenuButton("Tilfj inaktive rum i tidsperioden"); localDateTimeObject = LocalDateTime.now(); Callback<ListView<LocalDateTime>, ListCell<LocalDateTime>> cellFactory = new Callback<ListView<LocalDateTime>, ListCell<LocalDateTime>>() { @Override/*from www .j a va 2 s. c om*/ public ListCell<LocalDateTime> call(ListView<LocalDateTime> param) { return new ListCell<LocalDateTime>() { @Override public void updateItem(LocalDateTime item, boolean empty) { super.updateItem(item, empty); if (!empty) { String value = ScheduleHeader.WEEK_DAY_NAMES[item.getDayOfWeek() - 1]; value = value.replaceFirst(value.substring(1, value.length()), value.substring(1, value.length()).toLowerCase()); setText("Uge " + item.getWeekOfWeekyear() + " den " + item.getDayOfMonth() + "/" + item.getMonthOfYear() + " - " + value); } } }; } }; cBDateTimeStart.setButtonCell(cellFactory.call(null)); cBDateTimeStart.setCellFactory(cellFactory); Callback<ListView<LocalDateTime>, ListCell<LocalDateTime>> cellFactory2 = new Callback<ListView<LocalDateTime>, ListCell<LocalDateTime>>() { @Override public ListCell<LocalDateTime> call(ListView<LocalDateTime> param) { return new ListCell<LocalDateTime>() { @Override public void updateItem(LocalDateTime item, boolean empty) { super.updateItem(item, empty); if (!empty) { String value = ScheduleHeader.WEEK_DAY_NAMES[item.getDayOfWeek() - 1]; value = value.replaceFirst(value.substring(1, value.length()), value.substring(1, value.length()).toLowerCase()); setText("Uge " + item.getWeekOfWeekyear() + " den " + item.getDayOfMonth() + "/" + item.getMonthOfYear() + " - " + value); } } }; } }; cBDateTimeEnd.setButtonCell(cellFactory2.call(null)); cBDateTimeEnd.setCellFactory(cellFactory2); setBottomHBoxPadding(15, 15, 15, 15); cBContainer = new VBox(20); cBContainer.setAlignment(Pos.CENTER); cBContainer.setPadding(new Insets(15, 15, 15, 15)); super.addToCenter(cBContainer); cBContainer.getChildren().addAll(cBDateTimeStart, cBDateTimeEnd); super.getBottomHBox().getChildren().add(0, assignRooms); assignRooms.setOnAction(e -> { }); }
From source file:view.popups.shift.ShiftManualPopup.java
private void initComboboxes() { cWeek = new ComboBox(); cWeek.setPrefWidth(170);//from ww w . ja va 2 s . c om ArrayList<LocalDateTime> mondays = getTwelveMondays(); for (int i = 0; i < mondays.size(); i++) { cWeek.getItems().add(mondays.get(i)); } Callback<ListView<LocalDateTime>, ListCell<LocalDateTime>> cellFactory = new Callback<ListView<LocalDateTime>, ListCell<LocalDateTime>>() { @Override public ListCell<LocalDateTime> call(ListView<LocalDateTime> param) { return new ListCell<LocalDateTime>() { @Override public void updateItem(LocalDateTime item, boolean empty) { super.updateItem(item, empty); if (!empty) { String value = ScheduleHeader.WEEK_DAY_NAMES[item.getDayOfWeek() - 1]; value = value.replaceFirst(value.substring(1, value.length()), value.substring(1, value.length()).toLowerCase()); setText("Uge " + item.getWeekOfWeekyear() + " den " + item.getDayOfMonth() + "/" + item.getMonthOfYear() + " - " + value); } } }; } }; cWeek.setButtonCell(cellFactory.call(null)); cWeek.setCellFactory(cellFactory); cEmployee = new ComboBox(); cEmployee.setPrefWidth(170); cEmployee.setDisable(true); cRoom = new ComboBox(); cRoom.setPrefWidth(170); cRoom.setDisable(true); }
From source file:view.popups.shift.ShiftPopup.java
private void initComboboxes() { cDate = new ComboBox(); cDate.setPrefWidth(170);/* w ww . ja v a 2 s . co m*/ LocalDateTime now = new LocalDateTime(); now = now.withHourOfDay(0); now = now.withMinuteOfHour(0); LocalDateTime currentWeek = now; LocalDateTime threeMonthsForward = now.plusMonths(3); ArrayList<LocalDateTime> startDates = Xray.getInstance().getDatesInPeriod(currentWeek, threeMonthsForward); for (int i = 0; i < startDates.size(); i++) { if (startDates.get(i).getDayOfWeek() == 1) { cDate.getItems().add(startDates.get(i)); } } Callback<ListView<LocalDateTime>, ListCell<LocalDateTime>> cellFactory = new Callback<ListView<LocalDateTime>, ListCell<LocalDateTime>>() { @Override public ListCell<LocalDateTime> call(ListView<LocalDateTime> param) { return new ListCell<LocalDateTime>() { @Override public void updateItem(LocalDateTime item, boolean empty) { super.updateItem(item, empty); if (!empty) { String value = ScheduleHeader.WEEK_DAY_NAMES[item.getDayOfWeek() - 1]; value = value.replaceFirst(value.substring(1, value.length()), value.substring(1, value.length()).toLowerCase()); setText("Uge " + item.getWeekOfWeekyear() + " den " + item.getDayOfMonth() + "/" + item.getMonthOfYear() + " - " + value); } } }; } }; cDate.setButtonCell(cellFactory.call(null)); cDate.setCellFactory(cellFactory); cEmployee = new ComboBox(); cEmployee.setPrefWidth(170); cEmployee.setDisable(true); }