[Solved] Date/time comparison


You can create a function that returns the difference between two dates, run all the possible dates through this function, then pick the lowest difference.

Something like this (pseudo c code)

 int array[numdates];
 for (int i=0;i<numdates;i++)
     array[i]=compareDates(date[index], currentDate);

Then you can sort the array so the lowest number is at the beginning (or end) and return that one.

solved Date/time comparison