SimpleDateFormat simpledateformat = new SimpleDateFormat("yyyy-MM-dd");
Date d1 = simpledateformat .parse("2018-03-31");
Date d2 = simpledateformat .parse("2012-03-31");
if (d1before d2) {
System.out.println("Date1 is before Date2");
}
else if (d1 after d2) {
System.out.println("Date1 is afterrDate2");
}
Kindly note:The date formats of both the dates must be same.
Kindly note:The date formats of both the dates must be same.
No comments:
Post a Comment