我有两个日历calendarCurrent
和calendarReceived
,如何检查它们是否在同一天(不要花费数小时,分钟,秒)
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_PATTER, Locale.US);
String receivedStringDate = "2012-12-01T00:33:24.935Z";
sdf.parse(receivedStringDate, new ParsePosition(0));
calendarCurrent = Calendar.getInstance(Locale.US);
calendarReceived = sdf.getCalendar();
答案 0 :(得分:2)
检查他们的YEAR,MONTH和DATE字段是否相同:Calendar.get(int)
答案 1 :(得分:1)
答案 2 :(得分:0)
使用:
Calendar.YEAR
Calendar.MONTH
Calendar.DAY_OF_MONTH
参考:http://www.vogella.com/articles/JavaDateTimeAPI/article.html