今日の日付の7日前の日付を取得しようとしています。今日の日付を取得するために SimpleDateFormat を使用しています。
SimpleDateFormat sdf1 = new SimpleDateFormat("dd/MM/yyyy");
これを案内してください
私が最も役立つと思った更新された回答
SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy");
String currentDateandTime = sdf.format(new Date());
Date cdate=sdf.parse(currentDateandTime);
Calendar now2= Calendar.getInstance();
now2.add(Calendar.DATE, -7);
String beforedate=now2.get(Calendar.DATE)+"/"+(now2.get(Calendar.MONTH) + 1)+"/"+now2.get(Calendar.YEAR);
Date BeforeDate1=sdf.parse(beforedate);
cdate.compareTo(BeforeDate1);
返信ありがとうございます