I know this will be a silly question, but I tried everything and still couldn't achieve what I wanted to do.
This is my question:
I want to check two time values and a date, I have string which is having time like this "05.30 AM". I want to convert it into time format [it is better if i can convert exactly the way it is now]. I know there is a way which can compare two time values using:
NSComparisonResult result = [date1 compare:date2];
.
I have followed below code to convert my string value to the time format but it is only returns null.
Please guide me for this issue:
NSString* tim = @"11:12 AM";
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateStyle:NSDateFormatterShortStyle];
NSDate *formatedTime= [formatter dateFromString:tim];
NSLog(@"TIME : %@",formatedTime);