Wednesday, 11 September 2013

Compare two dates by date portion only, not time

Compare two dates by date portion only, not time

i don't want to compare year, months and days...it can affect the
performance...is there any api for direct comparison ?
Date date1 = new Date(d1.getYear() d1.getMonth(), d1.getDate());
Date date2 = new Date(d2.getYear(), d2.getMonth(), d2.getDate());
date1.compareTo(date2);

No comments:

Post a Comment