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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With