I want to convert NSString to NSDate but UIPickerView shows current date
Posted
by
Ali
on Stack Overflow
See other posts from Stack Overflow
or by Ali
Published on 2011-01-14T07:46:24Z
Indexed on
2011/01/14
7:54 UTC
Read the original article
Hit count: 313
I want to convert NSString to NSDate but UIPickerView shows current
datedatePicker=[[UIDatePicker alloc]init]; datePicker.userInteractionEnabled=YES; datePicker.minuteInterval=5; NSLog(@"Date"); //////// NSString *curDate=alarmData.date; //Jan 14, 2011 11:37 NSDateFormatter *format = [[NSDateFormatter alloc] init]; [format setDateFormat:@"MMM dd, yyyy HH:mm"];
//Optionally for time zone converstions
[format setTimeZone:[NSTimeZone timeZoneWithName:nil]];
NSDate *da = [format dateFromString:curDate];
[datePicker setDate:da animated:YES];
any suggestions
© Stack Overflow or respective owner