Check out example codes for "java create date object from yesterday". It will help you in understanding the concepts better.

Code Example 1

Date date = DateUtils.addDays(new Date(), -1);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
return sdf.format(date);

Learn ReactJs, React Native from akashmittal.com