Is there a way I can get an array of (string of days of the week) so: monday, tuesday, wednesday.... and also for months?
I can manually create that array, but I was wondering if there a more开发者_高级运维 eloquent way of doing this... Thanks.
This code;
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
NSArray *weekdays = [dateFormatter weekdaySymbols];
will give you the the weekdays in the users current locale.
If you want a particular locale set the desired locale on the dateFormatter
.
Creating an NSDateFormatter
is expensive so create one and reuse it.
精彩评论