Adding days to NSDate
- by karthick
I want add days to a date, I got many codes for this but none of them are working for me below shown is my code,please somebody help me to fix this issue
int daysToAdd=[[appDlegateObj.selectedSkuData
objectForKey:@"Release Time"] intValue];
NSTimeInterval secondsForFollowOn=daysToAdd*24*60*60;
NSString *dateStr=[contentDic objectForKey:@"Date"];
NSDateFormatter *dateFormatter=[[NSDateFormatter alloc]init];
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
NSDate *dateFromString=[[NSDate alloc]init];
dateFromString=[dateFormatter dateFromString:dateStr];
[dateFormatter release];
NSDate *date=[dateFromString dateByAddingTimeInterval:secondsForFollowOn];