I am new at iOS development.
I use just simple UILocalNotification
in my apps. I get fire date from UIDatePicker
which has
self.datePicker.datePickerMode = UIDatePickerModeTime
When i set my time by UIDatePicker
then i want to fire date base on UIDatePicker
time
I got is by
NSLog(@"%@", self.datePicker.date);
console : 2013-08-09 10:28:30 +0000 -------> ( wrong time i got.)
So, I convert this time to NSString
by NSDateFormatter
NSDateFormatter *dateFormator = [[NSDateFormatter alloc] init];
[dateFormator setDateFormat:@"h:mm a"];
NSLog(@"%@", [dateFormator stringFromDate:self.datePicker.date]);
console : 3:58 PM -------> ( Here i got proper time)
But in fireDate
property of NSLocalNotification
i need to apply its value as NSDate
,
So i again convert NSString (that i got it proper time) to NSDate
.
NSDate *fireDate = [[NSDate alloc] init];
fireDate = [dateFormator dateFromString:[dateFormator stringFromDate:self.datePicker.date]];
console : 2000-01-01 10:28:00 +0000 -------> ( wrong time i got.)
Here Question is How can i set proper time in NSLocalNotification by
UIDatePicker
(with also am/pm)?
I just need to fire proper time that i got in second console (as NSString
)
Please help me on this issue.