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

后端 未结 5 425
闹比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:08

    The full list of format specifiers is UTS#35 Date Format Patterns.

    Does the 'c' character work in place of 'E'? The document has it as a very close alternative and it may produce the result you want.

    (If you really want characters in the format string that are not in the table you can escape them, like hh 'o''clock' a, zzzz - produces format like "12 o'clock PM, Pacific Daylight Time".)

提交回复
热议问题