iphone - Date Picker format problems -
how solve problem got 2011-07-21 15:55:01 +0000 , timing off 4 hr, how remove +0000? , want format eg. friday 12 june 2011 1:30 pm
-(ibaction)addbutton:(id)sender { nsdate *choice = [datepick date]; nsstring *words = [[nsstring alloc]initwithformat:@"%@", choice]; uialertview *alert = [[uialertview alloc]initwithtitle:@"date chosen message:words delegate:nil cancelbuttontitle:@"ok" otherbuttontitles:nil]; [alert show]; [alert release]; [words release]; label.text = words; textfield.text = words; } - (void)viewdidload { nsdate *now = [[nsdate alloc] init]; [datepick setdate:now animated:yes]; [now release]; datepick.minimumdate = [nsdate date]; [super viewdidload]; }
nsdateformatter *formatter = [[nsdateformatter alloc] init]; [formatter setdateformat:@"eeee dd mmmm yyyy h:mm a"]; nsstring *words = [formatter stringfromdate:choise];
here date formatter guide.
Comments
Post a Comment