Convert between date formats in Objective-C
问题 I am trying to convert a date into a different format. I'm receiving my date as an NSString with the following format: EEE MMM dd HH:mm:ss ZZZ yyyy , and am attempting to change it to this format: dd-mm-yy . However, I am not able to get it in desired format. This is my current code: NSString *dateStr = [NSString stringWithFormat:@"%@",[dict valueForKey:@"createdOn"]]; [dateFormatter setDateFormat:@"EEE MMM dd HH:mm:ss zzz yyyy"]; NSTimeZone *gmt = [NSTimeZone timeZoneWithAbbreviation:@"IST"]