Convert UTC to local time with NSDateFormatter
问题 I am getting the following string from a server in my iOS app: 20140621-061250 How can I convert it to the local time? How can I define my date formatter? Is this correct? dateFormatter.dateFormat = @"YYYYMMd-HHmmss"; 回答1: The question doesn't specify the nature of what you mean by converting, exactly, but the first thing you should do, regardless of the final goal, is to correctly parse the server response using a properly configured NSDateFormatter . This requires specification of the