I want to have the following date format when doing System.out.println()
: 31/03/2016
.
Since I pass the format in a String type in this way "31-03-2016"
, I use the classes
import java.util.Date;
import java.text.DateFormat;
java.text.SimpleDateFormat;
to format it correctly, and I use this form:
SimpleDateFormat d = new SimpleDateFormat("dd-MM-yy");
Date date = d.parse("31-03-2016");
System.out.println(DateFormat.getDateInstance().format(date));
But it shows me: 31-03-2016