Calendar ci = Calendar.getInstance();
CiDateTime = "" + (ci.get(Calendar.MONTH) + 1) +
"/" + ci.get(Calendar.DAY_OF_MONTH) +
"/" + ci.get(Calendar.YEAR);
String visitdatetime = CiDateTime + "" +
ci.get(Calendar.HOUR_OF_DAY) + ":" +
ci.get(Calendar.MINUTE) + ":" +
ci.get(Calendar.SECOND);
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy hh:mm a");
I am getting from the server in 24 hours format.but want to show my date like MM/dd/yyyy hh:mm AM/PM like 12 hrs format.
Did you try this ?
SimpleDateFormat dateFromat= new SimpleDateFormat("MM/dd/yyyy hh:mm aa");
Date today = new Date();
String todayStr = dateFromat.format(today);