title: Java: How to convert and to show a date from database to textfield
body: <p>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.</p>
  
  <p>I'm trying to use this but no success:</p>
  
  <pre><code>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);
  </code></pre>