public static String dateToWeek(Date datetime) {
String[] weekDays = { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
Calendar cal = Calendar.getInstance(); // 获得一个日历
cal.setTime(datetime);
int w = cal.get(Calendar.DAY_OF_WEEK) - 1; // 指示一个星期中的某天。
if (w < 0) {
w = 0;
}
return weekDays[w];
}
Java code accumulation: judging the day of the week based on the date
Guess you like
Origin blog.csdn.net/cd18333612683/article/details/79396684
Ranking