How to set UIDatePicker to an initial date other than "Today"

SpokaneDude picture SpokaneDude · Jan 4, 2013 · Viewed 21.1k times · Source

I need to set the initial date to something other than "Today" so the user is forced to make a selection. I have found that if the user does NOT make a selection, the date/time is set to "nil"; I can send an UIAlertView, but that is after the fact.

I have looked at SO and Google, but found nothing. How can I do this?

UPDATE: actually, I didn't state it, but the year is not shown, only month, day and am/pm. Without the year, they might not see a future date. T

Answer

cory ginsberg picture cory ginsberg · Jan 4, 2013

One question, how do you know that the user will not pick that specific date that you set it to?

I would use

[datePicker setDate:[NSDate date]];

to display today's date on the date picker.