public static long getTimeDiffer(String endDate, String startDate,String dateFomart) throws ParseException {
SimpleDateFormat sf = new SimpleDateFormat(dateFomart);
Date onDate = sf.parse(endDate);
Date ofDate = sf.parse(startDate);
Calendar onc = Calendar.getInstance();
onc.setTime(onDate);
//结束时间
long offdutyValue = onc.getTimeInMillis();
Calendar onf = Calendar.getInstance();
onf.setTime(ofDate);
//开始时间
long ondutyValue = onf.getTimeInMillis();
return (offdutyValue - ondutyValue) / (1000 * 60);
}
java 计算两个时间相差多少分
最新推荐文章于 2023-11-13 14:32:14 发布