|
@@ -1594,21 +1594,16 @@ public class DateUtils extends PropertyEditorSupport {
|
|
*/
|
|
*/
|
|
public static String getdateFromWeek(int number) {
|
|
public static String getdateFromWeek(int number) {
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
- Calendar c = Calendar.getInstance();
|
|
|
|
- // 今天是一周中的第几天
|
|
|
|
- int dayOfWeek = c.get(Calendar.DAY_OF_WEEK);
|
|
|
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
|
|
|
- if (c.getFirstDayOfWeek() == Calendar.SUNDAY) {
|
|
|
|
- c.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
|
|
|
+ while (calendar.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) {
|
|
|
|
+ calendar.add(Calendar.DAY_OF_WEEK, -1);
|
|
}
|
|
}
|
|
- // 计算一周开始的日期
|
|
|
|
- c.add(Calendar.DAY_OF_MONTH, -dayOfWeek);
|
|
|
|
-
|
|
|
|
for (int i = 1; i <= 7; i++) {
|
|
for (int i = 1; i <= 7; i++) {
|
|
- c.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
|
if (number == i) {
|
|
if (number == i) {
|
|
- return sdf.format(c.getTime());
|
|
|
|
|
|
+ return sdf.format(calendar.getTime());
|
|
}
|
|
}
|
|
|
|
+ calendar.add(Calendar.DAY_OF_MONTH, 1);
|
|
}
|
|
}
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|