/**
* @Description: 转换时间格式
* @Date: 2021-10-11 下午 4:41
* @Param: [mss]
* @return: java.lang.String
* @Author: rendh
**/
public static String formatDateTime(long mss) {
String DateTimes = null;
long year = mss / (60 * 60 * 24 * 365);
long days = (mss % (60 * 60 * 24 * 365)) / (60 * 60 * 24);
long hours = (mss % (60 * 60 * 24)) / (60 * 60);
long minutes = (mss % (60 * 60)) / 60;
long seconds = mss % 60;
if (year > 0) {
DateTimes = year + "年" + days + "天" + hours + "小时" + minutes + "分钟"
+ seconds + "秒";
} else if (days > 0) {
DateTimes = days + "天" + hours + "小时" + minutes + "分钟"
+ seconds + "秒";
} else if (hours > 0) {
DateTimes = hours + "小时" + minutes + "分钟"
+ seconds + "秒";
} else if (minutes > 0) {
DateTimes = minutes + "分钟"
+ seconds + "秒";
} else {
DateTimes = seconds + "秒";
}
return DateTimes;
}
}