I hope this isn't GMT related or I will feel rather stupid.
2 quick related questions. Why is this converting to a different date? Is losing a day. I looked at time zones as stated in other answers but it is always the GMT timezone 0000 which is what I expected. I presume the error is in my setDateFormat but I can't see how to fix it.
NSString *stringFromDate = self.dateLabel.currentTitle;
NSLog(@"StringFromDateWeight! %@", stringFromDate);
NSDateFormatter *df = [[NSDateFormatter alloc] init];
//Convert Back to NSDate
[df setDateFormat:@"ddMMyyyy"];
NSDate *inputedDate = [df dateFromString: stringFromDate];
NSLog(@"StringFromDateWeight2! %@", inputedDate);
NSLog(@"StringFromDateWeight! %@", stringFromDate);
is
17072013
NSLog(@"StringFromDateWeight2! %@", inputedDate); is
2013-07-16 23:00:00 +0000
I am also using the code below to compare 2 dates and am I right in that it returns in seconds? How would I change it to return in days?
int intervall = (int) [theDate timeIntervalSinceDate: now];