将毫秒转为00:00:00的时间格式
public static String getDateByMS(long longMS) { //long day = 0l;//天 long hour = 0l;//时 long minute = 0l;//分 long second = 0l;//秒 String H = "00"; String M = "00"; String S = "00"; //long millisecond = 0l;//毫秒 //millisecond = longMS%1000; System.out.println(longMS); second = longMS / 1000; if (second >= 60) { minute = second / 60; second = second % 60; if (minute >= 60) { hour = minute / 60; minute = minute % 60; } } if (hour <= 9L) { H = "0" + hour; } else { H = String.valueOf(hour); } if (minute <= 9L) { M = "0" + minute; } else { M = String.valueOf(minute); } if (second <= 9L) { S = "0" + second; } else { S = String.valueOf(second); } return H + ":" + M + ":" + S; }
学习时的痛苦是暂时的 未学到的痛苦是终生的
作者:卷心菜的奇妙历险
本文版权归作者和博客园共有,遵循 CC 4.0 BY-SA 版权协议,欢迎转载 转载请附上原文出处链接和本声明,否则保留追究法律责任的权利。