java 8 date string yesterday code example
Example 1: java yesterday date
LocalDate today = LocalDate.now();
LocalDate yesterday = today.minusDays(1);
// In string format
LocalDate today = LocalDate.now();
String yesterday = (today.minusDays(1)).format(DateTimeFormatter.ISO_DATE);
Example 2: java create date object from yesterday
Date date = DateUtils.addDays(new Date(), -1);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
return sdf.format(date);