Skip to content

Instantly share code, notes, and snippets.

@Pasanpr
Created March 29, 2017 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pasanpr/b31e72fcc99bb928ecd783d64ec576c9 to your computer and use it in GitHub Desktop.
Save Pasanpr/b31e72fcc99bb928ecd783d64ec576c9 to your computer and use it in GitHub Desktop.
import Foundation
struct Formatter {
static let formatter = DateFormatter()
static func date(from string: String) -> Date? {
formatter.dateFormat = "d MMM yyyy"
return formatter.date(from: string)
}
}
let dateStrings = ["10 Oct 1988", "11 Jan 1947", "28 Mar 2002"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment