I am comparing two NSDates called serverDate and localDate. Despite both dates outputting to be the same time, I continue to get that serverDate is show to be more recent than localDate.
Here is my code for comparison:
if ([serverDate timeIntervalSinceReferenceDate] > [localDate timeIntervalSinceReferenceDate]) {
NSLog(@"server date more recent");
} else if ([serverDate timeIntervalSinceReferenceDate] <= [localDate timeIntervalSinceReferenceDate]){
NSLog(@"local date more recent");
}
I have used extremely precise NSDateFormatter to display the date as "yyyy-MM-dd HH:mm:ss:SSSSSSSSSSZ", which outputs the following: Server date: 2014-09-17 23:20:02:5090000000-0700, local date: 2014-09-17 23:20:02:5090000000-0700. But even then, serverDate continue to be regarded as the more recent date.
What am I doing incorrectly? Thanks for your input.