Coocoo4Cocoa
Coocoo4Cocoa

Reputation: 50826

Formatting date with NSDateFormatter on the iPhone

Since initWithDateFormat:allowNaturalLanguage: is now deprecated,

NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] initWithDateFormat:@"%B %d, %Y" allowNaturalLanguage:NO] autorelease];

How does one currently format with the same formatting string using 2.2.1?

Upvotes: 0

Views: 245

Answers (2)

Ilanchezhian
Ilanchezhian

Reputation: 17478

Pl. use the following steps:

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];

Upvotes: 1

Ecton
Ecton

Reputation: 10722

Just manually assign to dateFormat and only use "init" instead of "initWithDateFormat:...".

The Natural Language stuff is what appears to be deprecated.

Upvotes: 0

Related Questions