把long类型的时间转化为几时几分几秒

        long time = 3600000+366000;//1m = 1000毫秒
        Date date = new Date(time);
       
        long hour = time/(60*60*1000);
        long minute = (time - hour*60*60*1000)/(60*1000);
        long second = (time - hour*60*60*1000 - minute*60*1000)/1000;
        System.out.println(hour+ "时" + minute + "分 " + second+"秒");
 

你可能感兴趣的:(long)