ios - NSDateFormatter can't format previous stored date -
i passing date
stored in dictionary
block of code string value of trimmed date 'dd-mm
', problem getting trimmed version of current date return , not date have passed. please trim date have passed.
-(nsstring *)trimdate : (nsdate *) date { nsdateformatter *formatter = [[nsdateformatter alloc] init]; [formatter setdateformat:@"dd-mm"]; nsstring *result = [formatter stringfromdate:[nsdate date]]; return result; }
you have change this
nsstring *result = [formatter stringfromdate:[nsdate date]];
to
nsstring *result = [formatter stringfromdate:date];
check this
-(nsstring *)trimdate : (nsdate *) date { nsdateformatter *formatter = [[nsdateformatter alloc] init]; [formatter setdateformat:@"dd-mm"]; nsstring *result = [formatter stringfromdate:date]; return result; }
Comments
Post a Comment