Formatear fechas y horas en un String para un datatable

Deseamos formatear una fecha para mostrarla en un datatable

En el formulario list.html

<b:dataTableColumn value="#{jmoordbNotificationsController.showDate(item.date)}" label="#{app['field.date']}"/>

En el Controller crear los métodos

  // <editor-fold defaultstate="collapsed" desc="String showDate(Date date)">
    public String showDate(Date date){
          String h = "";
        try {
           // h = DateUtil.dateFormatToString(date, "dd/MM/yyyy") ;
          h = DateUtil.dateFormatToString(date, "dd/MM/yyyy") + " "+showHour(date);
        } catch (Exception e) {
            JsfUtil.errorMessage("showDate() " + e.getLocalizedMessage());
        }
        return h;
    }// </editor-fold>
    // <editor-fold defaultstate="collapsed" desc="String showHour(Date date)">
    public String showHour(Date date) {
        String h = "";
        try {
            h = DateUtil.hourFromDateToString(date);
        } catch (Exception e) {
            JsfUtil.errorMessage("showHour() " + e.getLocalizedMessage());
        }
        return h;
    }// </editor-fold>

Last updated