在iPhone上使用NSDateFormatter格式化日期
由于initWithDateFormat:AllowNaturAllLanguage:现在已不推荐使用在iPhone上使用NSDateFormatter格式化日期,iphone,cocoa,cocoa-touch,objective-c,Iphone,Cocoa,Cocoa Touch,Objective C,由于initWithDateFormat:AllowNaturAllLanguage:现在已不推荐使用 NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] initWithDateFormat:@"%B %d, %Y" allowNaturalLanguage:NO] autorelease]; 使用2.2.1当前如何使用相同的格式化字符串进行格式化?只需手动分配给dateFormat,并仅使用“init”而不是“initWit
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] initWithDateFormat:@"%B %d, %Y" allowNaturalLanguage:NO] autorelease];
使用2.2.1当前如何使用相同的格式化字符串进行格式化?只需手动分配给dateFormat,并仅使用“init”而不是“initWithDateFormat:…”
自然语言内容似乎已被弃用。Pl.使用以下步骤:
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];