Reputation: 2810
I want my Time to convert it to 24hrs format.
Input: 2014-07-23 07:44:47 +0000
Output: 19:44:47 <<< I want this format 24hrs
// MY Code
NSLog(@"before %@",selectedDate);
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"hh:mm a"];
NSLog(@"after %@",[dateFormat stringFromDate:selectedDate]);
this is what I got instead:
EDIT:
Also tried: [dateFormat setDateFormat:@"HH:mm a"];
Result is:
Upvotes: 0
Views: 90
Reputation: 82759
your code is fine always understand the concept
[dateFormat setDateFormat:@"hh:mm a"];
hh- 12 hour format
HH - 24 hour format
[dateFormat setDateFormat:@"HH:mm a"];
remind that always, K
Upvotes: 1