-(void) viewdidload { [super viewdidload]; Do any additional setup after loading the view, typically from a nib.} -(void) didreceivememorywarning { [super didreceivememorywarning]; Dispose of any resources the can be recreated.} -(Ibaction) onclick: (ID) Sender { NSDate *thedate = self.dataPicker.date; The Descriptionwithlocale method returns the local time //Currentlocale returns the current consumer information NSLog (@ "The date picked is:%@", [thedate Descriptionwithlocale:[nslocale Currentlocale]]); Sets the difference between format format/DD and dd nsdateformatter *dateformatter = [[NSDateFormatter alloc] init]; [Dateformatter setdateformat:@ "Yyyy-mm-dd HH:mm:ss"]; Output NSLog (@ "The date formate is:%@", [Dateformatter stringfromdate:thedate]); Self.label.text = [Dateformatter stringfromdate:thedate]; }
See note: The difference between DD and DD is that DD returns the day ordinal of the current month, and DD returns the day of the year
Date selector (iOS development)