Quote:
Originally Posted by imsatasia
Hello.!
Anyone please help me to get the value of UIDatePicker to UILable on button click for IpHone Application.
Thanks
|
Here is my answer for the above question:
-
Code:
(IBAction) timeChange: (id)sender
{
NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateStyle:NSDateFormatterLongStyle];
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
NSString *theTime;
theTime = [dateFormatter stringFromDate:[myDatePicker date]];
showDate.text = theTime;
}
This will show me date as "January 29, 2010 10:20 PM".
Thanks