Example usage for org.joda.time LocalDateTime minusDays

List of usage examples for org.joda.time LocalDateTime minusDays

Introduction

In this page you can find the example usage for org.joda.time LocalDateTime minusDays.

Prototype

public LocalDateTime minusDays(int days) 

Source Link

Document

Returns a copy of this datetime minus the specified number of days.

Usage

From source file:org.devgateway.eudevfin.projects.module.components.util.RateUtil.java

public static LocalDateTime getStartOfMonth(LocalDateTime commitmentDate) {
    return commitmentDate.minusDays(commitmentDate.getDayOfMonth() - 1);
}

From source file:org.incode.eurocommercial.ecpcrm.module.loyaltycards.dom.card.request.CardRequestRepository.java

License:Apache License

@Programmatic
public List<CardRequest> listRecentlyIssuedRequests() {
    LocalDateTime end = clockService.nowAsLocalDateTime();
    LocalDateTime start = end.minusDays(7);
    return repositoryService.allMatches(
            new QueryDefault<>(CardRequest.class, "findByIssueDateRange", "startDate", start, "endDate", end));
}

From source file:org.incode.eurocommercial.ecpcrm.module.loyaltycards.dom.card.request.CardRequestRepository.java

License:Apache License

@Programmatic
public List<CardRequest> listRecentlyHandledRequests() {
    LocalDateTime end = clockService.nowAsLocalDateTime();
    LocalDateTime start = end.minusDays(7);
    return repositoryService.allMatches(
            new QueryDefault<>(CardRequest.class, "findByHandleDateRange", "startDate", start, "endDate", end));
}

From source file:view.popups.timePeriod.AddTimePeriodPopup.java

private void fillContent() {
    try {/* www  . j a  va 2  s  .c  o m*/
        ArrayList<Employee> employees = Xray.getInstance().getPersonControl().getEmployees();

        for (int i = 0; i < employees.size(); i++) {
            cEmp.getItems().add(employees.get(i));
        }
        cEmp.getSelectionModel().selectFirst();
    } catch (DatabaseException ex) {
        new ExceptionPopup().display(ex.getMessage());
    }

    try {
        ArrayList<Room> rooms = Xray.getInstance().getRoomControl().getRooms();

        for (int i = 0; i < rooms.size(); i++) {
            cRoom.getItems().add(rooms.get(i));
        }
        cRoom.getSelectionModel().selectFirst();
    } catch (DatabaseException ex) {
        new ExceptionPopup().display(ex.getMessage());
    }

    //Fyld datoer ind i comboboks til start og slutdato:
    LocalDateTime now = new LocalDateTime();
    LocalDateTime oneWeekBack = now.minusDays(7);
    LocalDateTime oneMonthForward = now.plusMonths(1);
    ArrayList<LocalDateTime> startDates = Xray.getInstance().getDatesInPeriod(oneWeekBack, oneMonthForward);
    for (int i = 0; i < startDates.size(); i++) {
        cStart.getItems().add(startDates.get(i));
    }
    cStart.getSelectionModel().selectFirst();

    //Lav et cellfactory p comboboksen s datoerne vises overskueligt.
    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 dayName = ScheduleHeader.WEEK_DAY_NAMES[item.getDayOfWeek() - 1];
                        setText(item.toString("dd/MM") + " " + dayName.substring(0, 1)
                                + dayName.substring(1).toLowerCase());
                    }
                }

            };
        }
    };

    Xray.getInstance().fillDatesInEndDate(cEnd, cStart, 1);

    cStart.setButtonCell(cellFactory.call(null));
    cStart.setCellFactory(cellFactory);
    cEnd.setButtonCell(cellFactory.call(null));
    cEnd.setCellFactory(cellFactory);

}