NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"hh:mm:ss a"]; NSLog(@"Today Time: %@", [formatter stringFromDate:[NSDate date]]);
The above code just gives the following Today Time: 15:46:43 output Today Time: 15:46:43 I want the result to be Today Time: 3:46 PM . I was busy a lot and I did not find a way to show AM / PM. It would be really helpful if someone could help me find a way out. I am using Xcode 6.3 and my device has iOS 8.3 installed in it.
datetime ios nsdate date-format nsdateformatter
Manju basha
source share