How to display time from UIDatePicker?

That code looks fine to me. Did you double check that your label/datepicker are linked up correctly (either through IB or however you created them)? Also, in what way specifically does the code not work?

Up vote 0 down vote favorite share g+ share fb share tw.

I'm using a UIDatePicker in time mode to get the time. I'm trying to display the time selected in a label. The following code doesn't work NSDateFormatter *outputFormatter = NSDateFormatter alloc init; outputFormatter setDateFormat:@"h:mm a"; label.

Text = outputFormatter stringFromDate:self.datePicker. Date; outputFormatter release; objective-c cocoa-touch uidatepicker link|improve this question asked Sep 22 '10 at 4:35javascript ninja1,834944 58% accept rate.

You were right about the link. I forgot to make the link in IB. The code works.

– javascript ninja Sep 22 '10 at 4:55.

It seems you are just trying to set the time format in setDateFormat. Call the below function as your selector method - Resolved. - (void)changeDateInLabel:(id)sender{ NSDateFormatter *df = NSDateFormatter alloc init; df setDateStyle:NSDateFormatterMediumStyle; df setDateStyle:NSDateFormatterShortStyle; df setDateFormat:@"MM/dd/yyyy"; df setTimeZone:@"h:mm a"; }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions