public String getMonday(String date) {
if (date == null || date.equals("")) {
System.out.println("date is null or empty");
return "0000-00-00 00:00:00";
}
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date d = null;
try {
d = format.parse(date);
}
catch(Exception e) {
e.printStackTrace();
}
Calendar cal = Calendar.getInstance();
cal.setTime(d);
//set the first day of the week is Monday
cal.setFirstDayOfWeek(Calendar.MONDAY);
cal.set(Calendar.DAY_OF_WEEK,Calendar.MONDAY);
return format.format(cal.getTime())+ " 00:00:00";
}
文章地址https://www.yii666.com/article/758121.html 网址:yii666.com文章来源地址:https://www.yii666.com/article/758121.html