get yesterday date in java 8 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);