//Get today's date
//Example: Today (9)/3(tue)→9/2(mon)To get)
//I am using a calendar because localDate cannot be used.
Date today = new Date();
Calendar day = Calendar.getInstance();
//Method to get monday
day.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
today = day.getTime();
//Format to String type (if necessary)
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
String strToday = sdf.format(today);
Recommended Posts