Your entire block of code can simply be:
NSDate *date = name[@"startDate"];
Since the error indicates that you are actually getting an NSDate
from your name
dictionary.
Keep in mind that if you simply use NSLog
on the NSDate
, it will be shown in UTC format.
If you want to convert the date to a specific string format for display to the user, then update your code as follows:
NSDate *date = name[@"startDate"];
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"yyyy-MM-dd hh:mm:ss a"];
NSString *theDateFormatted = [dateFormat stringFromDate:date];