回答編集履歴

1

ソースコードを修正

2021/06/14 02:23

投稿

hallen0225
hallen0225

スコア587

test CHANGED
@@ -46,9 +46,13 @@
46
46
 
47
47
  // 日付を加減算する
48
48
 
49
- Calendar lWeek1 = (Calendar) now.clone().add(Calendar.DAY_OF_MONTH, -week - 6); // 先週の月曜
49
+ Calendar lWeek1 = (Calendar) now.clone(); // 先週の月曜
50
50
 
51
- Calendar lWeek2 = (Calendar) now.clone().add(Calendar.DAY_OF_MONTH, -week); // 先週の日曜
51
+ Calendar lWeek2 = (Calendar) now.clone(); // 先週の日曜
52
+
53
+ lWeek1.add(Calendar.DAY_OF_MONTH, -week - 6);
54
+
55
+ lWeek2.add(Calendar.DAY_OF_MONTH, -week);
52
56
 
53
57
  System.out.println("先週は" + lWeek1 + "~" + lWeek2.toString());
54
58