Data from the database to a PopupDateField

I have to put a data from the database to a PopupDateField but I can not.
I try to;
fechaSalidaDateField.setDateFormat (“dd-MM-yyyy”);
fechaSalidaDateField.setValue (new Date (refF.getFechaSalidaPrevista ()));
but it did not work

Hi Esteban,

What exactly is not working? What are you getting?

Aprovecho que hablas en Español.
Lo que necesito es que el PopupDateField quede con el dato de la fecha que le paso pero no lo logo hacer.
Simplemente queda vacío

Better to keep the thread in english, someone could face the same problem in future :wink:

Try this:

Date fechaSalida = new Date(refF.getFechaSalidaPrevista()); fechaSalidaDateField.setValue(fechaSalida); Place a breakpoint on line 2, inspect the value of
fechaSalida
, and check that you are not getting a null value but the correct one.

I capture it as: Mon November 24 2014 22:31:27 ART and need in a format like 13/11/2014 00:00:00

If your date type is java.sql.Date, so you can use the native converter with the specified format:

fechaSalidaDateField.setConverter(new DateToSqlDateConverter());
fechaSalidaDateField.setDateFormat("dd/MM/yyyy HH:mm:ss");
fechaSalidaDateField.setValue(fechaSalida);

Y do this and makes the trick
Date feSal = (fechaSalidaDateField.getValue()); // Fecha de salida
Date fechaConv = convertJavaDateToSqlDate(feSal);
String feFinal = fechaConv + " 00:00:00";
System.out.println("Date: " + feFinal);

public java.sql.Date convertJavaDateToSqlDate(java.util.Date date) {
return new java.sql.Date(date.getTime());
}