Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.
/ DateParser Public archive

Simple ISO 8601 and Unix timestamp Swift date parser

License

Notifications You must be signed in to change notification settings

3lvis/DateParser

Repository files navigation

logo

Simple ISO 8601 and Unix timestamp Swift date parser.

Usage

// ISO 8601
let isoDate = try Date(dateString:"2015-06-23T14:40:08.000+02:00")

// Unix Timestamp
let timestampDate = try Date(unixTimestampString:"1441843200")

// Returns DateType.ISO8601  
let isoDateType = "2014-01-02T00:00:00.007450+00:00".dateType

// Returns DateType.UnixTimestamp
let timestampDateType = "1441843200000000".dateType

Supported Formats

2014-01-02
2016-01-09T00:00:00
2014-03-30T09:13:00Z
2016-01-09T00:00:00.00
2015-06-23T19:04:19.911Z
2014-01-01T00:00:00+00:00
2015-09-10T00:00:00.184968Z
2015-09-10T00:00:00.116+0000
2015-06-23T14:40:08.000+02:00
2014-01-02T00:00:00.000000+00:00

Installation

DateParser is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'DateParser'

DateParser is also available through Carthage. To install it, simply add the following line to your Cartfile:

github "SyncDB/DateParser"

License

DateParser is available under the MIT license. See the LICENSE file for more info.

Author

Elvis Nuñez, @3lvis