I wrote the following code
Date d = new Date(); CharSequence s = DateFormat.format(\"MMMM d, yyyy \", d.getTime());
But is asking me para
This is the code i used:
Date date = new Date(); // to get the date SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy"); // getting date in this format String formattedDate = df.format(date.getTime()); text.setText(formattedDate);