i'm using [NSDate date] to get the current date but it is returning 5hrs 30 mts forward. it is returning different time before PM and after PM. My requirement is I want to delete the data in cache after 1 hr of duration.
At present I'm using following code to calculate the time difference. //storyDate is the one which is stored in cache...
NSTimeInterval timeGapInSeconds =fabs([[NSDate date] timeIntervalSinceDate:storyDate]);
NSInteger daysGap= timeGapInSeconds/86400;
NSInteger hoursGap = timeGapInSeconds/3600;
NSInteger mtsGap = timeGapInSeconds/60;
NSLog(@"days gap %lu, hours gap is %lu",(long)daysGap,(long)hoursGap);
NSLog(@"time gap in seconds %f",timeGapInSeconds);
NSLog(@"time gap in mins %f",timeGapInSeconds/60);
NSLog(@"current date:%@",[NSDate date]);