Retrieving date and time from UIDatePicker iOS

I want to get the date and time in the format, for example, "Friday May 31, 2013 12:00." How can I achieve this using NSDateFormatter?

+6
source share
1 answer
NSDate *myDate = datePicker.date; NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:@"cccc, MMM d, hh:mm aa"]; NSString *prettyVersion = [dateFormat stringFromDate:myDate]; 
+21
source

Source: https://habr.com/ru/post/945047/


All Articles