How to set custom date format in iOS?

I want to display the data in the following format: 14:23 Sep 10,2012 . How can i do this?

+4
source share
1 answer

Use NSDateFormatter

 NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"hh:mm MMM dd,yyyy"]; NSString *stringFromDate = [dateFormatter stringFromDate:[NSDate date]]; NSLog(@"today : %@", stringFromDate); 
+18
source

All Articles