java数据格式逻辑
我得到了日期格式的代码。我的examDateFormat是这样打印出来的:
Jan 01 = 1
Feb 02 = 11
March 03 = 21
April 04 = 31
例如,在二月,它应该显示02,但它显示11。我不知道如何修正这种逻辑。请帮我看一下。谢谢
for (ExamTimetable exam: listOfExam) {
Calendar cal = Calendar.getInstance();
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
Date date = null;
date = format.parse(exam.getM_scheduledDate());
cal.setTime(date); //correct date
String examDateFormat = cal.get(Calendar.DAY_OF_MONTH) + "/" + cal.get(Calendar.MONTH) + 1 + "/" + cal.get(Calendar.YEAR);
int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
String day = new DateFormatSymbols().getShortWeekdays()[dayOfWeek];
if (examDateFormat.equals(mDates)) {
dataList.add(new ExamInfo(exam.getM_subjectFullName(), exam.getM_subjectCode(), examDateFormat + " " + "(" + day + ")", exam.getM_startTime(), exam.getM_endTime(), exam.getM_venueId(), exam.getM_seatingNo()));
}
}
共 (0) 个答案