懒羊羊
2023-11-14 8286c62256f23bc2367a6729c0f46f84215e380b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package cn.stylefeng.guns.workflow.core.util;
 
/**
 * 时间计算工具类
 *
 * @author fengshuonan
 * @Date 2019/8/7 23:14
 */
public class TimeCalcUtil {
 
    /**
     * 根据耗时的毫秒数计算天时分秒
     *
     * @author fengshuonan
     * @Date 2019-08-28 14:41
     */
    public static String calc(Long millisSeconds) {
        long tian = millisSeconds / (1000 * 60 * 60 * 24);
        long shi = (millisSeconds % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60);
        long fen = (millisSeconds % (1000 * 60 * 60 * 24)) % (1000 * 60 * 60) / (1000 * 60);
        long miao = (millisSeconds % (1000 * 60 * 60 * 24)) % (1000 * 60 * 60) % (1000 * 60) / 1000;
        return tian + "天" + shi + "时" + fen + "分" + miao + "秒";
    }
 
}