I wrote the following code
Date d = new Date();
CharSequence s = DateFormat.format(\"MMMM d, yyyy \", d.getTime());
But is asking me para
public static String getcurrentDateAndTime(){
Date c = Calendar.getInstance().getTime();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd");
String formattedDate = simpleDateFormat.format(c);
return formattedDate;
}
// String currentdate= getcurrentDateAndTime();
I've already used this:
Date What_Is_Today=Calendar.getInstance().getTime();
SimpleDateFormat Dateformat = new SimpleDateFormat("dd-MM-yyyy");
String Today=Dateformatf.format(What_Is_Today);
Toast.makeText(this,Today,Toast.LENGTH_LONG).show();
at first I get time, then I declared a Simple Date Format (to get date like: 19-6-2018) then I use format to change date to string.