Skip to content

Instantly share code, notes, and snippets.

@carljparker
Last active August 27, 2015 18:21
Show Gist options
  • Save carljparker/ed6fd95fc6dbcdad7479 to your computer and use it in GitHub Desktop.
Save carljparker/ed6fd95fc6dbcdad7479 to your computer and use it in GitHub Desktop.
NSDateFormatter Singleton
static NSDateFormatter *formatter = nil;
static dispatch_once_t onceToken;
dispatch_once( &onceToken, ^{
formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment