Get chosen date from UIDatePicker

October 14th, 2010
#ui #date & time

This took me an age to track down. How do you get the value out of the UIDatePicker that the user has selected. Having used UIPickerView a lot, I thought that UIDatePicker object would have been an extension of UIPickerView and with the same methods, however this turned out not to be the case and the solution for UIDatePicker was much more straight forward.

[datePicker date]; //where datePicker is the name of your date picker instance

What do you think? Let me know by getting in touch on Twitter - @wibosco

William Boles

William has been an iOS developer since 2010, after all these years he just hopes that the String API will stop changing now.