I am getting a NSString(in which i have a date)from database, I need to add days like suppose 10//12/15/45/60 days to the date, How can I do it.
when I am trying with this piece of code :
NSString *expiryDateStr = [NSString stringWithFormat:@"%@",[[assets valueForKeyPath:@"assetrewards.expirydate"] objectAtIndex:0]];
NSLog(@" date %@",expiryDateStr);
//DATE FORMATTER
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"dd/MM/yyyy"];
NSDate *_date = [dateFormat dateFromString:expiryDateStr];
[dateFormat setDateFormat:[NSString stringWithFormat:@"dd MMM yyyy HH:mm"]];
[dateFormat setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:3600*5]];
NSLog(@"date format %@",dateFormat);
NSLog(@"Date: %@", _date);
I am getting output like this :
date 07/10/2013
date format <NSDateFormatter: 0x9f9d4a0>
Date: 2013-10-06 18:30:00 +0000
the date is getting changed, I am not knowing where i am going wrong, if that is the correct date how to add the days to the date.