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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With