ISO8601 in Swift
My answer on How do I get ISO 8601 date in iOS?
DateFormatter.date(string:)
let date = NSDate(timeIntervalSince1970: 1460111130)
XCTAssertEqual(DateFormatter.date(string: "2016-04-08T10:25:30Z"), date)
XCTAssertEqual(DateFormatter.date(string: "20160408 10:25:30Z"), date)
XCTAssertEqual(DateFormatter.date(string: "2016-04-08 112530 +010000"), date)
XCTAssertEqual(DateFormatter.date(string: "2016-04-08 202530GMT+1000"), date)
DateFormatter.string(date:)
let date = NSDate(timeIntervalSince1970: 1460111130)
XCTAssertEqual(DateFormatter.string(date: date), "2016-04-08T10:25:30 +0000")
ISO8601 is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ISO8601'
ISO8601 is also available through Carthage. To install just write into your Cartfile:
github "onmyway133/ISO8601"
Khoa Pham, [email protected]
We would love you to contribute to ISO8601, check the CONTRIBUTING file for more info.
ISO8601 is available under the MIT license. See the LICENSE file for more info.