When I was trying to convert April from 04 (MM) to Apr (MMM) it turned back into nil, is this a known issue in iOS or am I doing somet
I tried your code and it gives me null for year 2022, but years 2018,2020 it gives Apr ... weird!
NSString *dateString=@"2022-04-01";
NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
NSDate* myDate = [dateFormatter dateFromString:dateString];
[dateFormatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"+5:30"]];
[dateFormatter setDateFormat:@"MMM"];
NSString *stringFromDate = [dateFormatter stringFromDate:myDate];
NSLog(@"%@ == %@",dateString,stringFromDate);
UPDATE:
Please parse the string as this : 2016-04-01 01:00
Because of daylight saving in Jordan the clock will be shifted +1 hour so there's no time in the universe like this: 2016-04-01 00:00
This should resolve ur issues with the nil object.