i have a table in my database where i have a column with dates in format yyyy-MM-dd. I want to take the date from this table and to put it in a textfield in format dd/MM/yyyy.
I'm trying to use this but no success:
rsriga.next(); //the code is ok
SimpleDateFormat formatDate = new SimpleDateFormat("dd/MM/yyyy");
java.util.Date invoiceDate = formatDate.parse(txtformatteddanasc.getText().trim());
java.sql.Date sqlDate = new java.sql.Date(invoiceDate.getTime());
String formattedDate = "";
formattedDate = new SimpleDateFormat("dd/MM/yyyy",Locale.getDefault()).format(sqlDate);
txtformatteddanasc.setText(formattedDate);