Simple date format:
Date date = Calendar.getInstance().getTime();
// Display a date in day, month, year format
DateFormat formatter = new SimpleDateFormat("yyyy MM dd");
String today = formatter.format(date);
System.out.println("Today : " + today);
Link for the code above: Simple Date Format
Code snippet: DatePicker example find more in the link below:
final Calendar c = Calendar.getInstance();
year = c.get(Calendar.YEAR);
month = c.get(Calendar.MONTH);
day = c.get(Calendar.DAY_OF_MONTH);
// set current date into textview
textView.setText(new StringBuilder()
.append(year) .append(month + 1).append("-").append(day).append("-")
.append(" "));
Here you can find a great example: Mkyong android-date-picker-example