I used
[currentComps setFirstWeekday:2];
It returns the number of the day of week starting with Sunday. How should I hardcode returning this number starting with Monday?
I used
[currentComps setFirstWeekday:2];
It returns the number of the day of week starting with Sunday. How should I hardcode returning this number starting with Monday?
Contrary to the comment by Martin R, you can use NSCalendar
to specify the first day of the week via:
- (void)setFirstWeekday:(NSUInteger)weekday
Reading the documentation of NSCalendar
, it states the method setFirstWeekday:
Sets the index of the first weekday for the receiver.
I haven't tried this myself, but I would assume that creating an instance of NSCalendar
, calling the aforementioned method and also calling setCalendar:
on your NSDateComponents
would attenuate all dates components returned to work as you intend.