public long getDateDifference(String date1, String date2) {
long noOfDays = 0;
int days = 0;
Date validatDt1 = new Date();
Date validatDt2 = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy");
try {
validatDt1 = sdf.parse(date1);
validatDt2 = sdf.parse(date2);
noOfDays = (validatDt2.getTime() - validatDt1.getTime());
noOfDays = (noOfDays / (1000L * 60L * 60L * 24L * 365));
} catch (ParseException e) {
e.printStackTrace();
}
return noOfDays;
}
No comments:
Post a Comment