user1724168
user1724168

Reputation:

DatePicker include Year

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?

Upvotes: 8

Views: 9642

Answers (2)

Robert Harvey
Robert Harvey

Reputation: 180788

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

Upvotes: 7

ericgu
ericgu

Reputation: 2249

If you want to add month, date, year as well as time, add one picker that implements the dates only using (UIDatePickerModeDate) and an additional one for the time (UIDatePickerModeTime).

Upvotes: 5

Related Questions