Use [NSCalendar currentCalendar]
to get NSDateComponents from the current date, especially NSWeekdayCalendarUnit
and NSWeekOfYearCalendarUnit
. the components will have a member weekday
, that ranges from 1 — sunday
to 7 — saturday
. if it is 1
or 2
, create a new componets with weekday 2
, if it is 7
, add one to weekOfYear
and set weekday to 2
. for all other cases set weekday
to 7
.
Now use [NSCalendar currentCalendar]
again to create a day from the components.
solved Calculate next date in week