public static long dateDiff(int iField, Date startDate, Date endDate) {
		Calendar start = Calendar.getInstance();
		Calendar end = Calendar.getInstance();
		// long startTime = startDate.getTime();
		// long endTime = endDate.getTime();
		// long diffTime = endTime - startTime;
		int startYear = Integer.parseInt(getFormatDate(YYYY, startDate));
		int endYear = Integer.parseInt(getFormatDate(YYYY, endDate));
		int startMonth = Integer.parseInt(getFormatDate(MM, startDate)) - 1;
		int endMonth = Integer.parseInt(getFormatDate(MM, endDate)) - 1;
		int startDay = Integer.parseInt(getFormatDate(DD, startDate));
		int endDay = Integer.parseInt(getFormatDate(DD, endDate));
		int startHour = Integer.parseInt(getFormatDate(HH, startDate));
		int endHour = Integer.parseInt(getFormatDate(HH, endDate));
		int startMinute = Integer.parseInt(getFormatDate(MI, startDate));
		int endMinute = Integer.parseInt(getFormatDate(MI, endDate));

		switch (iField) {
		case DateUtil.YEAR:
			return endYear - startYear;
		case DateUtil.MONTH:
			long yearDiff = endYear - startYear;
			long monthDiff = endMonth - startMonth;
			return yearDiff * 12 + monthDiff;
		case DateUtil.DAY:
			start.set(startYear, startMonth, startDay, 0, 0, 0);
			end.set(endYear, endMonth, endDay, 0, 0, 0);
			return (end.getTimeInMillis() - start.getTimeInMillis()) / (1000 * 60 * 60 * 24);
		case DateUtil.HOUR:
			start.set(startYear, startMonth, startDay, startHour, 0, 0);
			end.set(endYear, endMonth, endDay, endHour, 0, 0);
			return (end.getTimeInMillis() - start.getTimeInMillis()) / (1000 * 60 * 60);
		case DateUtil.HOUR_OF_DAY:
			start.set(startYear, startMonth, startDay, startHour, 0, 0);
			end.set(endYear, endMonth, endDay, endHour, 0, 0);
			return (end.getTimeInMillis() - start.getTimeInMillis()) / (1000 * 60 * 60);
		case DateUtil.MINUTE:
			start.set(startYear, startMonth, startDay, startHour, startMinute, 0);
			end.set(endYear, endMonth, endDay, endHour, endMinute, 0);
			return (end.getTimeInMillis() - start.getTimeInMillis()) / (1000 * 60);
		default:
			break;
		}
		return end.getTimeInMillis() - start.getTimeInMillis();
	}