/**标签:转换,long,时间,milliseconds,sb,TimeUnit,工具,append,MILLISECONDS From: https://www.cnblogs.com/liftsail/p/16780021.html
* 毫秒转换为时间字符串
* @param milliseconds
* @return
*/
public static String timeStampToDhms(long milliseconds) {
long day = TimeUnit.MILLISECONDS.toDays(milliseconds);
long hours = TimeUnit.MILLISECONDS.toHours(milliseconds) - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(milliseconds));
long minutes = TimeUnit.MILLISECONDS.toMinutes(milliseconds) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(milliseconds));
long seconds = TimeUnit.MILLISECONDS.toSeconds(milliseconds) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(milliseconds));
StringBuilder sb = new StringBuilder();
if (day != 0) {
sb.append(day + "天");
}
sb.append(hours + "小时");
sb.append(minutes + "分");
sb.append(seconds + "秒");
return sb.toString();
}