Currently working on finding a solution to find the closest date compared to the current date using milliseconds. I understand part of the logic that needs to happen, but still a bit fuzzy about it all.
Looking to display the next tide relate to the current time. Get the index and display that data.
I know I would find the delta and compare the 2 times and the the one with the smallest delta correct? And iterate over them all.
Below is my code so far that works, I just need the conditional and logic worked out
NSNumber *tideDateEPOCH = [eachTideSummary valueForKeyPath:@"date.epoch"];
NSTimeInterval dateDeltaInterval = [tideDateEPOCH doubleValue];
NSTimeInterval dateDelta = dateDeltaInterval -  todayInEPOCH;
NSLog(@"tideDateEPOCH: %@", tideDateEPOCH);
NSLog(@"dateDelta: %f", dateDelta);
// Perform if conditional to see if the tide time array is the closest to the current date
// Return that index, then grab that index, display data within that index to the user (this is the next time information)
Below is a sample of my tideSummary array being returning. See date.epoch
"tideSummary": [
            {
                "date": {
                    "pretty": "11:58 AM PST on December 19, 2013",
                    "year": "2013",
                    "mon": "12",
                    "mday": "19",
                    "hour": "11",
                    "min": "58",
                    "tzname": "America/Los_Angeles",
                    "epoch": "1387483136"
                },
Logic I have in mind (needs some help and refining)
- Perform a for loop to loop through each index of the 
tideSummaryarray - Inside of the loop find out the difference in time from the 
currentTimetotideSummary.date.epoch - This is where I am confused. We have the difference between the 2 times above. Do I want to save the smallest time out of all the indexes and return that min index value
 - Once we return the smallest delta index value from the array. We can then grab this index with say: 
[tideSummaryArray objectAtIndex:nextTideIndex]; 
The data returning looks like it is sorted. Does that sound right? I found other posts that deal with NSDate - but if I have my time in EPOCH wouldnt that be easier/faster? Thoughts?