Today is Wednesday and I have this code
let calendar:NSCalendar = NSCalendar.currentCalendar()
let dateComps:NSDateComponents = calendar.components(.CalendarUnitWeekday , fromDate: NSDate())
let dayOfWeek:Int = dateComps.weekday
dayOfWeek is 4, but today is 3rd day of the week in Bulgaria. Is in USA today is 4th day of the week? And how to determine when the week starts in different countries and regions ? On my iPhone locale and calendar are set to Bulgarian calendar and locale and it knows that the week starts on Monday on my iMac also, but when I execute code it writes me 4...
calendar.firstWeekday
is the "index of the first weekday". A value of 1 corresponds to Sunday and 2 corresponds to Monday, same as withNSDateComponents
. Please correct me if I'm missing something. – Thulium