NSArray with days of the week and months of the year

Is there a way to get an array (a sequence of days of the week) like this: Monday, Tuesday, Wednesday ... and also for several months?

I can create this array manually, but I was wondering if there is an even more eloquent way to do this ... Thanks.

+4
source share
1 answer

This code;

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; NSArray *weekdays = [dateFormatter weekdaySymbols]; 

will give you business days in the current locale of users.

If you want a specific locale to set the desired language to dateFormatter .

Creating an NSDateFormatter expensive, so create one and reuse it.

+8
source

All Articles