Example usage for org.joda.time LocalDateTime toString

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

Introduction

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

Prototype

public String toString(String pattern) 

Source Link

Document

Output the date using the specified format pattern.

Usage

From source file:se.inera.certificate.schema.adapter.LocalDateAdapter.java

License:Open Source License

/**
 * Print a DateTime in ISO format./*from   w  ww  .  j a  va  2  s  . c o m*/
 */
public static String printIsoDateTime(LocalDateTime dateTime) {
    return dateTime.toString(ISO_DATETIME_PATTERN);
}

From source file:se.inera.statistics.hsa.adapter.LocalDateAdapter.java

License:Open Source License

/**
 * Converts a Joda Time LocalDateTime to an intyg:common-model:1:date.
 *//*from  w  w w . j  av a2 s .  c  o m*/
public static String printIsoDateTime(LocalDateTime dateTime) {
    return dateTime.toString(ISO_DATE_TIME_PATTERN);
}

From source file:view.popups.TimeInvestmentPopup.java

private void fillContent() {
    //Fyld datoer ind i comboboks til start og slutdato:
    LocalDateTime now = new LocalDateTime();
    LocalDateTime oneWeekBack = now.minusMonths(12);
    LocalDateTime oneMonthForward = now.plusMonths(12);
    ArrayList<LocalDateTime> startDates = Xray.getInstance().getDatesInPeriod(oneWeekBack, oneMonthForward);
    for (int i = 0; i < startDates.size(); i++) {
        cStart.getItems().add(startDates.get(i));
    }/*  w ww .j a  va2  s  .  c  o m*/
    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/yy") + " " + dayName.substring(0, 1)
                                + dayName.substring(1).toLowerCase());
                    }
                }

            };
        }
    };

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

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

}

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

private void fillContent() {
    try {//from  w  ww . j a  v a2  s . c  om
        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);

}