swift
1import UIKit 2 3class ViewController: UIViewController { 4 5 @IBOutlet weak var lablenow_time: UILabel! 6 7 override func viewDidLoad() { 8 super.viewDidLoad() 9 10 let lablenow_time = NSDate() // 現在日時の取得 11 12 let dateFormatter = DateFormatter() 13 dateFormatter.locale = NSLocale(localeIdentifier: "en_US") as Locale! // ロケールの設定 14 dateFormatter.dateFormat = "yyyy/MM/dd HH:mm:ss" // 日付フォーマットの設定 15 16 print(dateFormatter.string(from: lablenow_time as Date)) // -> 2014/06/25 02:13:18 17 } 18 19 override func didReceiveMemoryWarning() { 20 super.didReceiveMemoryWarning() 21 // Dispose of any resources that can be recreated. 22 } 23 24 25} 26
自分でやってみたこと
現在日時を習得しデバッグエリアのところまで表示させることが出来た
実現したいこと
表示されているlableに現在日時を表示できるようにしたいです
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2017/02/13 16:03
2017/02/13 17:03
退会済みユーザー
2017/02/14 00:23
退会済みユーザー
2017/02/16 04:10
退会済みユーザー
2017/02/16 04:11
退会済みユーザー
2017/02/16 13:59