Search code examples
objective-cnsdatenscalendareventkitnsdatecomponents

Is the starting day of the week stored in NSLocale somewhere?


I live in the Netherlands. We Dutch people like to see Monday as the start of the week. I know that people in the US like to consider Sunday as the start of the week. Silly Americans ;)

If I want to present a week view to my global users, can I get the preferred starting day of the week from NSLocale, or is a settings panel the only way to go?

Cheers, EP.


Solution

  • Use the following code:

    NSCalendar *calendar = [[NSLocale currentLocale] objectForKey:NSLocaleCalendar];
    NSUInteger firstDay = [calendar firstWeekday];
    

    You may also check this relevant question.