I have to convert the given time in 24 hr format.But I did not get it.Don’t know where I m going wrong.
If I have TimeStart as 1:15 PM then I should get 13:15 ..
Item *item=[sectionItems objectAtIndex:itemId];
NSLog(@"%@",item.TimeStart);
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"HH:mm a"];
NSString *formattedDateString = [dateFormatter stringFromDate:item.TimeStart];
NSLog(@"%@",formattedDateString);
In the code above I have a Item class and that I have NSString *TimeStart;
When I see formattedDateString it is returning null.How can I fix it ?
1 Answer