kal*_*pea 4 android date android-calendar
在给定的图像中,第一个日期是带有月和日的当前日期。另一个日期是从当前日期算起的第 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)
SimpleDateFormat dateFormat= new SimpleDateFormat("EEEE dd.MM.yyyy");
Calendar currentCal = Calendar.getInstance();
String currentdate=dateFormat.format(currentCal.getTime());
currentCal.add(Calendar.DATE, 7);
String toDate=dateFormat.format(currentCal.getTime());
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4056 次 |
| 最近记录: |