I'm trying to use dateByAddingTimeInterval:
to add 8 days to my current date but it gives me a weird result.
This is the code I'm using:
-(void)requestForGetEPGChannelsProgramsSucceed:(id)jsonResponse andEpgId:(NSString *)epgId forDate:(NSDate *)forDate dayOffset:(NSInteger)dayOffset
NSDate *dateWithOffset = [forDate dateByAddingTimeInterval:(dayOffset * 86400.0)];
forDate
represents the date of today with hour 0 and minutes 0. For this example forDate
is 30/09/2013 00:00
dayOffset
is 8.
I would expect to get 8/10/2013 00:00 but the value I'm getting (not printing) is 7/10/2013 23:00.
Why is that? Does someone have a clue?
EDIT: I just noticed that the first dates that come out well are IDT and after a few days it uses IST. The difference is between "Israel day-light time" and "Israel standard time" which is 1 hour difference.
How do I get over this obstacle?