I have list of dates:
23/08/2014 8:23:23
24/08/2014 5:23:23
24/08/2014 6:23:23
24/08/2014 7:23:23
24/08/2014 7:25:23
24/08/2014 8:23:23
I want to compare all dates to current date time and find the closest date time. Is there any simple way to compare them instead of looping and comparing?
I have tried below example
Date1.after(date2)
date1.compareTo(date2)>0
But I not able to accomplish the result.
I have to compare entire date and time not only date or time
by using below format i have to compare
Date currentTimeDate = new Date(System.currentTimeMillis());