The following code can be used to format dates in Android

 

SimpleDateFormat myFormat = new SimpleDateFormat(“yyyy.MM.dd”); // This will set which format we want for the date that we are checking.

String myDateString = myFormat.format(new Date()); // This will convert the current date to the format that we have given for the date formatter object.