I want to get localnotification when I set time so In the timepickker i am getting the time format like 07:14 Am/Pm that I required to convert like 19:14 so that I can set the values like
I want to convert 07 to 19 how to do that to put the values in datecomponet..
//getting time format 07:14 Am/Pm
NSString * time1 = Timepicker.text;
NSArray *array = [time1 componentsSeparatedByString:@":"];
[datecomponet setHour:19];
[datecomponet setMinute:38];
[dateformater setDateFormat:@"hh:mm a"];
self.Timepicker.text= [NSString stringWithFormat:@"%@",[dateformater stringFromDate:datepicker.date]];
/// This is local notification code
NSCalendar * gregcalender = [[NSCalendar alloc]initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
[gregcalender setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"IST"]];
NSDateComponents *datecomponet = [gregcalender components:NSCalendarUnitYear|NSCalendarUnitMonth | NSCalendarUnitDay|NSCalendarUnitHour|NSCalendarUnitMinute fromDate:date];
// [datecomponet setYear:2017];
// [datecomponet setMonth:12];
// [datecomponet setDay:16];
// [datecomponet setHour:18];
// [datecomponet setMinute:38];
NSInteger year = [datecomponet year];
NSInteger month = [datecomponet month];
NSInteger day = [datecomponet day];
NSString * time1 = Timepicker.text;
// NSInteger hour = [datecomponet hour];
// NSInteger min = [datecomponet minute];
//NSString *testString= @"It's a rainy day";
NSArray *array = [time1 componentsSeparatedByString:@":"];
[datecomponet setHour:18];
[datecomponet setMinute:38];
UIDatePicker * dd = [[UIDatePicker alloc]init];
[dd setDate:[gregcalender dateFromComponents:datecomponet]];
NSLog(@"======>NSNotification method tab<=====");