Error with java.sql.Date.valueOf

0

In this part of the code:

int seleccionado = cbotipo_reserva.getSelectedIndex();
    dts.setTipo_reserva((String) cbotipo_reserva.getItemAt(seleccionado));


    //fechas
    Calendar cal;
    int d,m,a;
    cal=dcfecha_reserva.getCalendar();
    d=cal.get(Calendar.DAY_OF_MONTH);
    m=cal.get(Calendar.MONTH);
    a=cal.get(Calendar.YEAR) - 1900;
    dts.setFecha_reserva(new Date(a,m,d));

    cal=dcfecha_ingresa.getCalendar();
    d=cal.get(Calendar.DAY_OF_MONTH);
    m=cal.get(Calendar.MONTH);
    a=cal.get(Calendar.YEAR) - 1900;
    dts.setFecha_ingresa(new Date(a,m,d));

    cal=dcfecha_salida.getCalendar();
    d=cal.get(Calendar.DAY_OF_MONTH);
    m=cal.get(Calendar.MONTH);
    a=cal.get(Calendar.YEAR) - 1900;
    dts.setFecha_salida(new Date(a,m,d));

    dts.setCosto_alojamiento(Double.parseDouble(txtcosto_alojamiento.getText()));
    seleccionado = cboestado.getSelectedIndex();
    dts.setEstado((String) cboestado.getItemAt(seleccionado));

I get the error already mentioned and makes when editing my table all the fields are reproduced, except those that are after and including a reservation date.

Edit: The stack trace that redirected me to that part of the code was missing

Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException
        at java.sql.Date.valueOf(Date.java:143)
    
asked by Yahaira Flores 30.06.2018 в 05:24
source

0 answers