I am able to print the current date how to subtract 2 days from the current date using date object.Whatever the previous questions asked in this site are not matched with my requirement.If I am using calender then I am getting different format of date. I want date format in yyyyMMdd only by using date object.I tried this but I am getting error like the operator - is undefined for the argument type(s) String, int. help me how to resolve this.
Date date = new Date();
DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
System.out.println("date is "+dateFormat.format(date));
Date dateBefore = new Date(dateFormat.format(date)) - (2 * 24 * 3600 * 1000));