Last active
April 17, 2017 23:00
-
-
Save ahcode0919/800079c7dde96c973a6e0b77715f0bf4 to your computer and use it in GitHub Desktop.
Example of handling dates in Swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let dateString = "09 Aug 2016 17:53:51 -0700" | |
let dateFormatter = NSDateFormatter() | |
// Good resource for date time format syntax | |
//http://userguide.icu-project.org/formatparse/datetime | |
dateFormatter.dateFormat = "dd MMM yyyy HH:mm:ss ZZZ" | |
let date = dateFormatter.dateFromString(dateString) //NSDate = "Aug 09, 2016, 5:53 PM" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment