Question: how to calculate difference between two dates using java?
Answer: Date dateObj2 = sdf. parse(date2 + " " + time2); ...  System. ...  DecimalFormat crunchifyFormatter = new DecimalFormat("###,###"); // getTime() returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object. ...  int diffDays = (int) (diff / (24 * 60 * 60 * 1000));