public static int compare_monuthAndDay(String date1, String date2) { int month1 = Integer.parseInt(date1.substring(5, 7)); int day1 = Integer.parseInt(date1.substring(8, 10)); int month2 = Integer.parseInt(date2.substring(5, 7)); int day2 = Integer.parseInt(date2.substring(8, 10)); if (month1 == month2 && day1 == day2) { return 0; } else { return 1; } }
Java 比较两个日期的月份和日是否相同
最新推荐文章于 2024-01-29 09:26:11 发布