I added a date picker to view. But when I select any date from the picker, it's shown this format:
Wednesday, December 14, 2011 1:50:52 PM India Standard Time
I want to change this format to
Wed, Dec 14 2011 1:50 PM
How can I get this format with NSDateFormatter
?
Try with below code .it will help you
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"EEE, MMM dd yyyy hh:mm a"];//Wed, Dec 14 2011 1:50 PM
NSString *str_date = [dateFormat stringFromDate:[NSDate date]];
NSLog(@"str_date = %@",str_date);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.