DatePicker include Year

user1724168 picture user1724168 · Nov 5, 2012 · Viewed 8.9k times · Source

I have dataPicker in my app implemented. But it only shows month,day,hour. How could I able to add year in the date picker. Any idea?

Answer

Robert Harvey picture Robert Harvey · Nov 5, 2012
datePicker.datePickerMode = UIDatePickerModeDate;

UIDatePickerModeDate

The date picker displays months, days of the month, and years. The exact order of these items depends on the locale setting. An example of this mode is [ November | 15 | 2007 ].

Available in iOS 2.0 and later.

Declared in UIDatePicker.h.

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIDatePicker_Class/Reference/UIDatePicker.html

Also you can change from storyboard set Mode: (Refer to screenshot)

enter image description here