在给定的图像中,第一个日期是带有月和日的当前日期。另一个日期是从当前日期算起的第 7 天。
我尝试使用以下代码::
Calendar cal = Calendar.getInstance();
cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
SimpleDateFormat sdf = new SimpleDateFormat("EEEE dd.MM.yyyy");
for (int i = 0; i < 7; i++) {
Log.i("dateTag", sdf.format(cal.getTime()));
cal.add(Calendar.DAY_OF_WEEK, 1);
}
tvDate1=(TextView) findViewById(R.id.calender_view1);
tvDate1.setText("" + DateFormat.format("dd/MM/yyyy", System.currentTimeMillis()));
tvDate2=(TextView) findViewById(R.id.calender_view2);
tvDate2.setText("here want to print 7thday");
Run Code Online (Sandbox Code Playgroud)