I want to convert "2014-07-15 06:55:14.198000+00:00" this string date to NSDate in Swift.
相关问题
- how to split a list into a given number of sub-lis
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
相关文章
- 现在使用swift开发ios应用好还是swift?
- JSP String formatting Truncate
- UITableView dragging distance with UIRefreshContro
- Using if let syntax in switch statement
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Selecting only the first few characters in a strin
- Enum with associated value conforming to CaseItera
This work for me..
Swift support extensions, with extension you can add a new functionality to an existing
class
,structure
,enumeration
, orprotocol
type.You can add a new
init
function toNSDate
object by extenging the object using theextension
keyword.Now you can init a NSDate object using:
Updated for Swift 3.
https://developer.apple.com/library/prerelease/mac/documentation/Cocoa/Reference/Foundation/Classes/NSDateFormatter_Class/index.html#//apple_ref/doc/uid/20000447-SW32