LoginSignup
50
46

More than 5 years have passed since last update.

[Swift]現在時刻の取得

Posted at

SwiftでNSDateを使って現在時刻を取得してみました。

コード

let now = NSDate()

let formatter = NSDateFormatter()
formatter.dateFormat = "yyyy/MM/dd HH:mm:ss"

let string = formatter.stringFromDate(now)

println(string)

出力結果

2014/07/28 17:11:29

まとめ

現在時刻を取得する、ここまではObjective-Cの時と特に変わりは無いようです。

50
46
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
50
46