質問編集履歴

1

追記しました。

2018/06/28 00:40

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -291,3 +291,55 @@
291
291
  ```Cell.detailTextLabel?.text = object.date```ですと型が違うというエラーが出るので
292
292
 
293
293
  ```Cell.detailTextLabel?.text = object.date.description```このようにしてみたがそうするとサブタイトルの表示が**<>**このような表示になってしまいます。
294
+
295
+
296
+
297
+ ### 追記
298
+
299
+ ```swift
300
+
301
+ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
302
+
303
+ let Cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
304
+
305
+
306
+
307
+ let object = todoItem[indexPath.row]
308
+
309
+ //let now = object.date// // 現在日時の取得
310
+
311
+
312
+
313
+ let dateFormatter = DateFormatter()
314
+
315
+ dateFormatter.locale = NSLocale(localeIdentifier: "en_US") as Locale? // ロケールの設定
316
+
317
+ dateFormatter.dateFormat = "yyyy年MM月dd日 HH:mm"//:ss" // 日付フォーマットの設定
318
+
319
+
320
+
321
+ let dateString = dateFormatter.string(from: object.date as Date)
322
+
323
+ print(dateString) // -> 2014/06/25 02:13:18*/
324
+
325
+
326
+
327
+
328
+
329
+ Cell.textLabel?.text = object.item
330
+
331
+ Cell.detailTextLabel?.text = object.date.description
332
+
333
+
334
+
335
+
336
+
337
+ return Cell
338
+
339
+
340
+
341
+
342
+
343
+ }
344
+
345
+ ```