I am trying to get NSDate object from string . I use the fallowing code
NSString *st1=@"4:39 AM";
NSDateFormatter *dateFormatter=[[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"hh:mm a"];
NSDate *dateobj=[dateFormatter dateFromString:st1];
NSLog(@"Date from string 4:39 AM is %@",dateobj);
But it gives wrong output such like as
Date from string 4:39 AM is 1969-12-31 23:09:00 +0000
What is the exact way to get the NSDate object from this type of strings.
Dont base your result on NSLoging
NSDate, since logging it will give you the time in GMTPlease refer to my answer on this question NSDateFormatter giving me time 4 hours ahead
For example if you want to fire a
UILocalNotificationat 4:39 am you would do the following