public final static int SUNDAY = 1;
/**
* Value of the {@link #DAY_OF_WEEK} field indicating
* Monday.
*/
public final static int MONDAY = 2;
/**
* Value of the {@link #DAY_OF_WEEK} field indicating
* Tuesday.
*/
public final static int TUESDAY = 3;
/**
* Value of the {@link #DAY_OF_WEEK} field indicating
* Wednesday.
*/
public final static int WEDNESDAY = 4;
Calendar已经默认SUNDAY为1
int o = calendar.get(Calendar.DAY_OF_WEEK);
if (o == Calendar.SUNDAY) {
int dayOfWeek = 7;
} else {
int dayOfWeek = o - 1;
}
//设置一周开始的计算方式
calendar.setFirstDayOfWeek(Calendar.MONDAY);
网友评论