私は、時間が 11:26 のときに 11:07 を示しているアプリケーションを開発しています。Calendar インスタンスを使用して行いました。
Calendar currentDate=Calendar.getInstance();
SimpleDateFormat ddMMyyyy=new SimpleDateFormat("dd/MM/yyyy");
datenow=ddMMyyyy.format(currentDate.getTime());
if(currentDate.get(Calendar.AM_PM)==Calendar.PM){
timenow=currentDate.get(Calendar.HOUR)+":"+currentDate.get(Calendar.MONTH)+":PM";
}else{
timenow=currentDate.get(Calendar.HOUR)+":"+currentDate.get(Calendar.MONTH)+":AM";
}
new MyToast(this, "Date = "+datenow+" time = "+timenow);
出力が間違っています。どうすればよいですか?