Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在iPhone上使用NSDateFormatter格式化日期_Iphone_Cocoa_Cocoa Touch_Objective C - Fatal编程技术网

在iPhone上使用NSDateFormatter格式化日期

在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

由于initWithDateFormat:AllowNaturAllLanguage:现在已不推荐使用

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];