回答編集履歴
1
修正
test
CHANGED
@@ -19,3 +19,67 @@
|
|
19
19
|
|
20
20
|
|
21
21
|
です。
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
```js
|
26
|
+
|
27
|
+
secondCount = 3000;
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
hours = Math.floor(secondCount / 3600);
|
32
|
+
|
33
|
+
minutes = Math.floor((secondCount % 3600) / 60);
|
34
|
+
|
35
|
+
seconds = Math.floor(secondCount % 60)
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
console.log(hours); //3600秒未満なので0時間
|
40
|
+
|
41
|
+
console.log((secondCount % 3600)); //3600秒未満なので3000すべてが余り
|
42
|
+
|
43
|
+
console.log(minutes);//↑から 3000/60になるので割り切れて50分
|
44
|
+
|
45
|
+
console.log(seconds);//あまりは出ないので0秒
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
//適当に入れて確認
|
52
|
+
|
53
|
+
secondCount = 132321;
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
hours = Math.floor(secondCount / 3600);
|
58
|
+
|
59
|
+
minutes = Math.floor((secondCount % 3600) / 60);
|
60
|
+
|
61
|
+
seconds = Math.floor(secondCount % 60)
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
console.log(hours);
|
66
|
+
|
67
|
+
console.log((secondCount % 3600));
|
68
|
+
|
69
|
+
console.log(minutes);
|
70
|
+
|
71
|
+
console.log(seconds);
|
72
|
+
|
73
|
+
/**
|
74
|
+
|
75
|
+
36
|
76
|
+
|
77
|
+
2721
|
78
|
+
|
79
|
+
45
|
80
|
+
|
81
|
+
21
|
82
|
+
|
83
|
+
**/
|
84
|
+
|
85
|
+
```
|