I have a date string which I want to convert to another format.
The original date string example is : "2013-06-04 02:19:21 +0000"
I want to convert this to "Wed, Jun 4"
NSString * date_string = @"2013-06-04 02:19:21 +0000";
NSDateFormatter *complexdateFormater = [[NSDateFormatter alloc] init];
[complexdateFormater setDateFormat:@"yyyy-M-DD HH:mm:ss Z"];
NSDate* complexdate = [complexdateFormater dateFromString:date_string];
NSString *formatString = [NSDateFormatter dateFormatFromTemplate:@"EE, MMM d" options:0
locale:[NSLocale currentLocale]];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:formatString];
NSString *todayString = [dateFormatter stringFromDate:complexdate];
but the today string for the above case prints out : the month as Jan irrespective of the month value in the original string.
where am i going wrong ?