package com.jimind.sportdemo.utils;

import java.util.Locale;

/**
 * 时间格式化工具类
 * @author Any
 */
public class TimeFormatUtils {
    public static String formatSeconds(long seconds) {
        seconds=seconds/1000;
        String standardTime;
        if (seconds <= 0) {
            standardTime = "00:00";
        } else if (seconds < 60) {
            standardTime = String.format(Locale.getDefault(), "00:%02d", seconds % 60);
        } else if (seconds < 3600) {
            standardTime = String.format(Locale.getDefault(), "%02d:%02d", seconds / 60, seconds % 60);
        } else {
            standardTime = String.format(Locale.getDefault(), "%02d:%02d:%02d", seconds / 3600, seconds % 3600 / 60, seconds % 60);
        }
        return standardTime;
    }
}
