String from = request.getParameter("send_from");
String to = request.getParameter("send_to");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/mm/dd");
Calendar calFrom = Calendar.getInstance();
calFrom.setTime(sdf.parse(from));
Calendar calTo = Calendar.getInstance();
calTo.setTime(sdf.parse(to));
long df = calTo.getTimeInMillis() - calFrom.getTimeInMillis();
long day = df / (3600*24*1000);
如果表單填入是同一月份內的日期 計算會正常
但是我用6/30-7/01這種跨月份時間差就會變成負的
而且用get(Calendar.MONTH)顯示永遠是0(Jan)
該怎麼解決...
謝謝><