How to get the 5th date of every month. So far I know how to get the current date. I just want to fire out local notification for 5th of every month.
Here is my code:
UILocalNotification *localNotification = [[[UILocalNotification alloc] init] autorelease];
if (!localNotification){
return;
}
NSDate *date = [NSDate date];
NSDate *dateToFire = ?; // please give me logic to find out 5th of evry month
[localNotification setFireDate:dateToFire];
[localNotification setTimeZone:[NSTimeZone defaultTimeZone]];
NSArray *array = [NSArray arrayWithObjects:@"Value 1", @"Value 2", nil];
NSDictionary *data = [NSDictionary dictionaryWithObject:array forKey:@"payload"];
[localNotification setUserInfo:data];
[localNotification setAlertBody:@"Incoming Local Notification" ];
[localNotification setAlertAction:@"Open App"];
[localNotification setHasAction:YES];
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
If I understood your question, then you may do this way: