Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieve date and time from UIDatePicker iOS

I want to retrieve date and time in format e.g "Friday May 31, 2013 12:00 pm". How can I achieve that with NSDateFormatter?

like image 380
Ali Shahid Avatar asked May 15 '13 07:05

Ali Shahid


1 Answers

NSDate *myDate = datePicker.date;

NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"cccc, MMM d, hh:mm aa"];
NSString *prettyVersion = [dateFormat stringFromDate:myDate];
like image 74
Buntylm Avatar answered Oct 19 '22 04:10

Buntylm