Last active
October 26, 2015 14:07
-
-
Save bobgodwinx/bde232c373f90ed71ce1 to your computer and use it in GitHub Desktop.
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
lazy var dateFormatter:NSDateFormatter = { | |
var dateFormatter:NSDateFormatter? | |
var __dispatchToken: dispatch_once_t = 0 | |
dispatch_once(&__dispatchToken) { | |
dateFormatter = NSDateFormatter() | |
/** | |
setting the default locale to Germany // for USA use us_US | |
*/ | |
dateFormatter?.locale = NSLocale(localeIdentifier: "de_DE") | |
/** | |
set date style as you want | |
*/ | |
dateFormatter?.dateStyle = .ShortStyle; | |
dateFormatter?.timeStyle = .ShortStyle; | |
/** | |
UTC DateStrings e.g. 2015-08-28T09:07:50 | |
dateFormatter?.dateFormat = "yyyy-MM-dd'T'HH:mm:ss" | |
UTC DataString e.g 2015-04-17T13:30:00+02:00 | |
dateFormater?.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZ" | |
*/ | |
} | |
return dateFormatter! | |
}() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment