Convert from Long to date format

前端 未结 6 1063
暗喜
暗喜 2020-12-14 06:01

I want to convert Long value to String or Date in this format dd/mm/YYYY.

I have this value in Long format: 1343805819061.

It is possible to convert it to Da

6条回答
  •  我在风中等你
    2020-12-14 06:45

        public String getDuration(long msec) {
            if (msec == 0)
                return "00:00";
            long sec = msec / 1000;
            long min = sec / 60;
            sec = sec % 60;
            String minstr = min + "";
            String secstr = sec + "";
            if (min < 10)
                minstr = "0" + min;
            if (sec < 10)
                secstr = "0" + sec;
            return minstr + ":" + secstr;
        }
    

提交回复
热议问题