What's wrong with how I'm using NSDateFormatter?

后端 未结 5 423
闹比i
闹比i 2021-01-30 10:01
   NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
   dateFormatter.locale = [[[NSLocale alloc] initWithLocaleIdentifier:@\"en_US\"] autorelease];
   [d         


        
5条回答
  •  情话喂你
    2021-01-30 10:30

    The problem that I found is that the string that I was parsing has some trailing characters "\n\t\t". The solution was to remove them:

    [string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];

提交回复
热议问题