通过此声明,我将返回星期几
int dayOfWeak = mycal.get(Calendar.DAY_OF_WEEK);
switch (dayOfWeak) {
case Calendar.SUNDAY:
break;
case Calendar.MONDAY:
break;
case Calendar.TUESDAY:
break;
case Calendar.WEDNESDAY:
break;
case Calendar.THURSDAY:
break;
case Calendar.FRIDAY:
break;
case Calendar.SATURDAY:
break;
但是如何才能将12个月传递给显示适配器?
答案 0 :(得分:0)
尝试使用SimpleDateFormat并使用模式MMMM
public String getMonth(){
String format = "MMMM";
SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.US);
return sdf.format(DATE_WITH_SPECIFIED_MONTH);
}
或想要获得整数值时的不同模式。
public int getMonth(){
String format = "M";
SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.US);
return sdf.format(DATE_WITH_SPECIFIED_MONTH);
}