I wrote the following code
Date d = new Date(); CharSequence s = DateFormat.format(\"MMMM d, yyyy \", d.getTime());
But is asking me para
A simple tweak to Paresh's solution:
Date date = Calendar.getInstance().getTime(); SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy"); String formattedDate = df.format(date);