public static int getYearsCount(Date startDate, int startHour,Date endDate, int endHour) {int yearCount = 0;// 获取之间的月数int monthCount = getMonthsCount(startDate, startHour, endDate, endHour);yearCount = monthCount / 12;if (monthCount % 12 != 0) {yearCount++;}// 返回年数return yearCount;}
如果觉得《根据起始日期 起始时间 终止日期 终止时间计算年数》对你有帮助,请点赞、收藏,并留下你的观点哦!