❤️ Support my apps ❤️
- Push Hero - pure Swift native macOS application to test push notifications
- PastePal - Pasteboard, note and shortcut manager
- Quick Check - smart todo manager
- Alias - App and file shortcut manager
- My other apps
❤️❤️😇😍🤘❤️❤️
ISO8601 in Swift
My answer on How do I get ISO 8601 date in iOS?
Create a new formatter
var config = Config()
config.timeZoneIdentifier = " +0000"
let formatter = Formatter(config: config)
or use the default
Formatter.shared
Formatter.shared.date(string: "2016-04-08T10:25:30Z") // extended format with Z
Formatter.shared.date(string: "20160408 10:25:30Z") // basic format with Z
Formatter.shared.date(string: "2016-04-08 112530 +010000") // extended format with timezone offset
Formatter.shared.date(string: "2016-04-08 202530GMT+1000") // extended format with GMT
Formatter.shared.date(string: "2016-04-08T10:25:30.000Z") // milliseconds
let date = Date(timeIntervalSince1970: 1460111130)
Formatter.shared.string(date: date) // 2016-04-08T10:25:30Z // timezone Z
ISO8601 is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ISO8601', git: 'https://github.com/onmyway133/ISO8601'
ISO8601 is also available through Carthage. To install just write into your Cartfile:
github "onmyway133/ISO8601"
Khoa Pham, onmyway133@gmail.com
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.