I want to fire a UILocalNotification
in a specific Date. If I use this code:
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentif
Try following code with 24 hour format:-
NSDate *date = [NSDate date];
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier: NSGregorianCalendar];
NSDateComponents *components = [gregorian components: NSUIntegerMax fromDate: date];
[components setHour:16];
[components setMinute:0];
[components setSecond:0];
NSDate *newDate = [gregorian dateFromComponents: components];
[gregorian release];
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
localNotif.fireDate = newDate;
localNotif.alertBody = [NSString stringWithFormat:@"Alarm for time : %@",newDate];
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
[localNotif release];