Repeat weekly notification

I have two notifications, and I want to repeat it in an alternate week.

eg. One notification set on the 1st week of Monday, and it should be repeated in the third week on Monday. The second notice is set on Tuesday of the 2nd week, and it should be repeated on Tuesdays of the 4th week.

What should I do for this?

+3
source share
2 answers

Get the week number and decide according to the week number

0
source
-(NSString*) getWeekOfMonth {
  NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
 [dateFormatter setDateStyle:NSDateFormatterMediumStyle];
 [dateFormatter setTimeStyle:NSDateFormatterShortStyle];
 [dateFormatter setDateFormat:@"W"];

 NSString *weekNumber = [dateFormatter stringFromDate:[NSDate date]];    
 [dateFormatter release];    
 return weekNumber;
}

NSInteger weekInt = [weekNumber integerValue];
0
source

Source: https://habr.com/ru/post/1654018/


All Articles