LoginSignup
24
24

More than 5 years have passed since last update.

Swiftで文字列からNSDateに変換する

Posted at

もっとスマートな方法はないものか...
Stringオブジェクトを拡張するとか...


var date_string: String = "2014-12-01 10:00:00"

var date_formatter: NSDateFormatter = NSDateFormatter()
date_formatter.locale     = NSLocale(localeIdentifier: "ja")
date_formatter.dateFormat = "yyyy/MM/dd HH:mm:ss"
date_formatter.dateFromString(date_string)
24
24
2

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
24
24