public static void main(String[] args) {
SimpleDateFormat dfs = new SimpleDateFormat("yy/MM/dd hh:mm:ss");
java.util.Date begin=dfs.parse("12/07/20 08:32:15");
java.util.Date end = dfs.parse("12/07/20 08:40:28");
long between=(end.getTime()-begin.getTime())/1000;//除以1000是为了转换成秒
long day1=between/(24*3600);
long hour1=between%(24*3600)/3600;
long minute1=between%3600/60;
long second1=between%60/60;
System.out.println(""+day1+"天"+hour1+"小时"+minute1+"分"+second1+"秒");
}