I need to get the field AM/PM in date object. How can i get it?
This is my code.
String startTime =\"01:05 PM\";
SimpleDateFormat sdf = new SimpleDa
use this..
String getTime(String milliseconds) {
String time = "";
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(Long.parseLong(milliseconds));
time = cal.get(Calendar.HOUR) + " : " + cal.get(Calendar.MINUTE);
if(cal.get(Calendar.AM_PM)==0)
time=time+" AM";
else
time=time+" PM";
return time;
}