In my application i have to show list of working hours by date in a table view,
Here i have 5 scenarios
I hope this will give you basic idea how you have to proceed: For other scenarios you can work out
- (NSDate *)firstDayOfWeekFromDate:(NSDate *)date {
NSCalendar* calendar = [NSCalendar currentCalendar];
NSDateComponents* comps = [calendar components:NSYearForWeekOfYearCalendarUnit |NSYearCalendarUnit|NSMonthCalendarUnit|NSWeekCalendarUnit|NSWeekdayCalendarUnit fromDate:date];
[comps setWeekday:2]; // 2: monday
return [calendar dateFromComponents:comps];
}