Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSDateFormatter "Month" in 3 letters instead of full word

    NSDateFormatter* formatter = [[NSDateFormatter alloc] init];     [formatter setDateFormat:@"dd-MM-YYYY HH:mm"];             [formatter setTimeZone:[NSTimeZone systemTimeZone]]; 

If i choose MM i get the month in number: 09-05-2012 15:33 If i choose MMMM i get the month in word: 09-May-2012 15:33

What i wanted, was the month in 3 letters abbreviation.
Eg: January would be Jan

In this case May is correct because it only has 3 letters.

like image 406
bruno Avatar asked May 09 '12 14:05

bruno


1 Answers

Have you tried: [formatter setDateFormat:@"dd-MMM-YYYY HH:mm"]; and then [formatter stringFromDate:someNSDate];

like image 62
graver Avatar answered Sep 19 '22 20:09

graver