Date Picker Control:

Source: Internet
Author: User
Tags dateformat

Date Picker controls: Chinese: Dates/The time picker Uidatepicker has an instance method of Setdate:animated, which selects the date programmatically.                                                Uidatepicker There are four modes: Time (selected only)                                                Date (selected dates only) Date and time (select the Times and dates) Count down Timer (countdown timer) Date picker does not allow you to specify seconds or time zone properties: Locale: Choose region Custom: Custom time setting minimum and maximum time, exceeding will automatically return to minimum time//Add a Time selectorUidatepicker *datepicker =[[Uidatepicker alloc] init];//date implicitly considers the current time//the NSDate object contains two parts, date, and time. The formatted time string is mainly for the date and time. NSDate *date = [NSDate Date];//generally added in the-(void) Viewdidload method, so that the sub-mirror loading is complete and can be displayed//NSDateFormatter class: For formatting NSDate objects, supporting localized informationNSDateFormatter *formatter =[[NSDateFormatter alloc] init];//Settings Display Chinese[Date Setlocale:[nslocale Localewithlocaleidentifier:@"ZH-CN"]];//or set the show us languageFormatter.locale = [[Nslocale alloc] initwithlocaleidentifier:@ "en-US"];//Window LayoutDatepicker.frame = CGRectMake ( +, -, -,162);//Date selector mode, the default style displays only the dateDatepicker.datepickermode =uidatepickermodedate;//Add a date selector to a view[Editbirthdayview Addsubviewpicker];//Use the Setdateformat: method to customize the date format[Formatter setdateformat:@] yyyy-mm-DD "];//or call DateFormat by object directly: method to format the dateFormatter.dateformat =@"yyyy-mm-dd a HH:mm:ss eeee";//Use the Stringfromdate: method to get time for the time picker and assign it to a string objectNSString *datestring =[Formatter stringFromDate:datePicker.date]; Use Setdateformat: method to customize the date format: yyyy: Full year YY: The following 2 digits of the year MM: Month, display as 1-December MMM: Month, shown in English month abbreviated,                                                                  For example: Jan MMMM: month, display full English month full name  such as: January DD: Day , a 2-digit number, such as: Genevad: Day,1-2-bit display, such as 2 EEE: Abbreviated day of the week, such as: Sunday                                                      EEEE: Full written day of the week, such as: Sunday AA: On, afternoon, AM/PM H: When, 24-hour system,0- atK: When, 12-hour system,0- Onem: minutes,1-2-bit mm: minute, 2-bit S: sec,1-2-bit ss: sec, 2-bit S: Ms Z: Time zone common date structure: YYYY-mm-DD HH:mm:ss. SSS yyyy-mm-dd HH:MM:SS yyyy-mm-DD MM DD yyyy

Date Picker Control:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.