I have a jdatechooser in my project and I want the user to choose a date, the problem is that if the user chooses August 2, 2018 when processing it results in September 2, 2020, I do not know how to readjust it
String dias = Integer.toString(fechacita.getCalendar().get(Calendar.DAY_OF_MONTH));
String mess = Integer.toString(fechacita.getCalendar().get(Calendar.MONTH + 1));
String anoss = Integer.toString(fechacita.getCalendar().get(Calendar.YEAR));
fecha = dias + "/" + mess + "/" + anoss;
try {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
Date parsedDate = dateFormat.parse(fecha);
dateFormat.format(parsedDate);
timestamp = new java.sql.Timestamp(parsedDate.getTime());
} catch (ParseException ex) {
Logger.getLogger(ModificarServicio.class.getName()).log(Level.SEVERE, null, ex);
JOptionPane.showMessageDialog(this, "Hubo un error, por favor contactar con el proveedor del servicio", "Error", JOptionPane.ERROR_MESSAGE);
}