回答編集履歴
1
修正
answer
CHANGED
@@ -8,4 +8,36 @@
|
|
8
8
|
60分で割って余る=時間に昇華されなかった分
|
9
9
|
60秒で割って余る=分に昇華されなかった秒
|
10
10
|
|
11
|
-
です。
|
11
|
+
です。
|
12
|
+
|
13
|
+
```js
|
14
|
+
secondCount = 3000;
|
15
|
+
|
16
|
+
hours = Math.floor(secondCount / 3600);
|
17
|
+
minutes = Math.floor((secondCount % 3600) / 60);
|
18
|
+
seconds = Math.floor(secondCount % 60)
|
19
|
+
|
20
|
+
console.log(hours); //3600秒未満なので0時間
|
21
|
+
console.log((secondCount % 3600)); //3600秒未満なので3000すべてが余り
|
22
|
+
console.log(minutes);//↑から 3000/60になるので割り切れて50分
|
23
|
+
console.log(seconds);//あまりは出ないので0秒
|
24
|
+
|
25
|
+
|
26
|
+
//適当に入れて確認
|
27
|
+
secondCount = 132321;
|
28
|
+
|
29
|
+
hours = Math.floor(secondCount / 3600);
|
30
|
+
minutes = Math.floor((secondCount % 3600) / 60);
|
31
|
+
seconds = Math.floor(secondCount % 60)
|
32
|
+
|
33
|
+
console.log(hours);
|
34
|
+
console.log((secondCount % 3600));
|
35
|
+
console.log(minutes);
|
36
|
+
console.log(seconds);
|
37
|
+
/**
|
38
|
+
36
|
39
|
+
2721
|
40
|
+
45
|
41
|
+
21
|
42
|
+
**/
|
43
|
+
```
|