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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -