Manipular fechas en Qt Jambi
Transformar de QDate a Date
//Definimos el formato de fecha deseado
SimpleDateFormat formatoDelTexto = new SimpleDateFormat("yyyy-MM-dd");
//Transformamos la fecha QDate a ese formato
fechaTexto = ui.datFechaNacimiento.date().toString("yyyy-MM-dd");
//Se setea al atributo del objeto
empleado.setFechaNacimiento(formatoDelTexto.parse(fechaTexto));
Transformar de Date a QDate
//Transformamos la fecha Date a String
String fechaTexto2 = empleado.getFechaIngreso().toString();
//La dividimos por los guiones
String[] fecha2 = fechaTexto2.split("-");
//La seteamos al componente usando el constructor QDate
ui.datFechaIngreso.setDate(new QDate(Integer.parseInt(fecha2[0]),
Integer.parseInt(fecha2[1]),
Integer.parseInt(fecha2[2])));
Advertisement