回答編集履歴
1
追記
test
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
dateFormatter.timeStyle = .medium
|
24
24
|
|
25
|
-
print(dateFormatter.string(from: now)) //
|
25
|
+
print(dateFormatter.string(from: now)) // 2017/09/17 19:16:11
|
26
26
|
|
27
27
|
|
28
28
|
|
@@ -42,6 +42,42 @@
|
|
42
42
|
|
43
43
|
|
44
44
|
|
45
|
+
```
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
追記
|
50
|
+
|
51
|
+
---
|
52
|
+
|
53
|
+
```
|
54
|
+
|
55
|
+
dateFormatter.dateStyle = .full
|
56
|
+
|
57
|
+
dateFormatter.timeStyle = .none
|
58
|
+
|
59
|
+
print(dateFormatter.string(from: now)) // 2017年9月17日 日曜日
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
let calendar = Calendar.current
|
64
|
+
|
65
|
+
let component = calendar.component(.weekday, from: now) // 1 日曜日: 1
|
66
|
+
|
67
|
+
let weekday = component - 1;
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
print(dateFormatter.shortWeekdaySymbols) // ["日", "月", "火", "水", "木", "金", "土"] 日: 0
|
72
|
+
|
73
|
+
print(dateFormatter.weekdaySymbols) // ["日曜日", "月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日"] 日曜日: 0
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
print(dateFormatter.weekdaySymbols[weekday]) // 日曜日
|
78
|
+
|
45
79
|
|
46
80
|
|
47
81
|
```
|
82
|
+
|
83
|
+
|