The following is the code I am using to change the date from one format to another. In the following code child.dob
is in NSDate
as yyyy-MM-dd
format I want to change to MMM dd, yyyy
format I am able to change the date format however I am getting a warning message here . Please help me to convert date without warning.. Thanks in advance.
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
NSDate *date = [dateFormatter dateFromString:child.dob];
[dateFormatter setDateFormat:@"MMM dd, yyyy"];
dobLabel.text = [dateFormatter stringFromDate:date];
This is the warning message I am getting: :801: warning: incompatible Objective-C types 'struct NSDate *', expected 'struct NSString *' when passing argument 1 of 'dateFromString: