Skip to content

Instantly share code, notes, and snippets.

@rickyngan
Forked from m1entus/dateFormatter.swift
Created September 21, 2016 06:19
Show Gist options
  • Save rickyngan/d7acf71a8da59a76f7c9e66a5ba52d2e to your computer and use it in GitHub Desktop.
Save rickyngan/d7acf71a8da59a76f7c9e66a5ba52d2e to your computer and use it in GitHub Desktop.
Swift NSDateFormatter singleton
class var userDateFormatter : NSDateFormatter {
struct Static {
static let instance: NSDateFormatter = {
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
return dateFormatter
}()
}
return Static.instance
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment