質問編集履歴
2
変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
Calendarクラス使って値をセットすると31日のみ翌月1日に変わってしまいます。(例:3/31が4/1となる)
|
2
2
|
|
3
3
|
このような場合に31日として読み込む方法は他にどのようなものがあるのでしょうか。
|
4
4
|
|
1
変数宣言を追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -8,8 +8,16 @@
|
|
8
8
|
|
9
9
|
```java
|
10
10
|
|
11
|
+
int testYear = 2018;
|
12
|
+
|
13
|
+
int testMonth = 3;
|
14
|
+
|
15
|
+
int testDay = 31;
|
16
|
+
|
11
17
|
Calendar testDate = Calendar.getInstance();
|
12
18
|
|
13
19
|
testDate.set(testYear,testMonth,testDay);
|
14
20
|
|
21
|
+
System.out.println(testDate);//2018,4,1と表示される
|
22
|
+
|
15
23
|
```
|