Skip to content

Instantly share code, notes, and snippets.

@iducool
Created September 10, 2014 11:45
Show Gist options
  • Save iducool/a2eaa76fd8a7320e0b97 to your computer and use it in GitHub Desktop.
Save iducool/a2eaa76fd8a7320e0b97 to your computer and use it in GitHub Desktop.
Detailed date formatter
NSString *format = @"yyyy:MM:dd HH:mm:ss";
NSString *dummyDateString = @"2014:09:10 01:34:10";
NSString *desiredFormat = @"EEEE, MMMM dd, yyyy, hh:mm a";
NSDateFormatter *df =[[NSDateFormatter alloc] init];
[df setDateFormat:format];
NSDate *currentDate = [df dateFromString:dummyDateString];
[df setDateFormat:desiredFormat];
NSString *finalDateString = [df stringFromDate:currentDate];
NSLog(@"Formatted date string:%@",finalDateString);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment