Is there a way to use NSNumberFormatter to get the \'th\' \'st\' \'nd\' \'rd\' number endings?
EDIT:
Looks like it does not exist. Here\'s what I\'m using.>
This will convert date to string and also add ordinal in the date. You can modify the date formatte by changing NSDateFormatter object
-(NSString*) getOrdinalDateString:(NSDate*)date
{
NSString* string=@"";
NSDateComponents *components = [[NSCalendar currentCalendar] components: NSCalendarUnitDay fromDate:date];
if(components.day == 1 || components.day == 21 || components.day == 31)
string = @"st";
else if (components.day == 2 || components.day == 22)
string = @"nd";
else if (components.day == 3 || components.day == 23)
string = @"rd";
else
string = @"th";
NSDateFormatter *dateFormatte = [[NSDateFormatter alloc] init];
[dateFormatte setFormatterBehavior:NSDateFormatterBehavior10_4];
[dateFormatte setDateFormat:[NSString stringWithFormat:@"d'%@' MMMM yyyy",string]];
NSString *dateString = [dateFormatte stringFromDate:date];
return dateString;
}