I have this string —-> Sun, 16 Dec 2012 15:30:22 +0000
I want to convert it to NSDate. I have tried the below code but it is giving me null
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"yyyy-MM-dd hh:mm:ss a"];
NSDate *date = [[NSDate alloc] init];
date = [df dateFromString: @"Sun, 16 Dec 2012 15:30:22 +0000"];
NSLog(@"date: %@", date);
I am not getting the issue ?
Any guidance plz
The
dateFormatof the formatter needs to match the format of the string you are providing it with.Therefore something like this should work
To look up what the specifiers actually mean check Unicode Technical Standard #35