public static long getMonthDiffOnlyOfTwoDate(Date startDate, Date endDate) { String start = TimeTool.toStrDateFromUtilDateByFormat(startDate, "yyyy-MM-dd"); String end = TimeTool.toStrDateFromUtilDateByFormat(endDate, "yyyy-MM-dd"); if (start.equals(end)) { // 只比较到月 return 0; } return getDaysOfTowDiffDate(startDate, endDate) / 30; }
public static void print(Object... args) { StringBuilder sb = new StringBuilder(TimeTool.getCurrentTime() + " "); for (Object arg : args) { sb.append(arg + " "); } System.out.println(sb.toString()); }