Created
September 10, 2014 11:45
-
-
Save iducool/a2eaa76fd8a7320e0b97 to your computer and use it in GitHub Desktop.
Detailed date formatter
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
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