0

Possible Duplicate:
Ordinal Month-day Suffix Option for NSDateFormatter setDateFormat

I'm trying to get the date to display Tues, Jan 24th 2012. Anyone know how to get the th nd, st, rd to show up?

NSDate *currDate = [NSDate date];
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
    dateFormatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en-US"];
    [dateFormatter setDateFormat:@"E, MMM dd, YYYY"];
    longDate = [dateFormatter stringFromDate:currDate];
    NSLog(@"%@",longDate);

will display Tue, Jan 24, 2012

Community
  • 1
  • 1
Bot
  • 11,868
  • 11
  • 75
  • 131
  • ... as well as [Return 1st from 1, 2nd from 2, …, 11th from 11,](http://stackoverflow.com/questions/3529887/return-1st-from-1-2nd-from-2-11th-from-11) – Julian D. Jan 24 '12 at 20:06
  • http://stackoverflow.com/questions/3312935/nsnumberformatter-and-th-st-nd-rd-ordinal-number-endings http://stackoverflow.com/questions/8404059/objective-c-format-numbers-to-ordinals-1-2-3-to-1st-2nd-3rd – jscs Jan 24 '12 at 20:17
  • Didn't see any of those in the search results when I typed the question. Thanks – Bot Jan 24 '12 at 20:22

0 Answers0