unity 由总秒数推出时分秒

 /// 
    /// 计算时分秒
    /// 
    /// 总共多少秒
    /// 
    string GetTime(float time)
    {
        float h = Mathf.FloorToInt(time / 3600f);
        float m = Mathf.FloorToInt(time / 60f - h * 60f);
        float s = Mathf.FloorToInt(time - m * 60f - h * 3600f);
        return  monthh.ToString("00")+dayy.ToString("00")+ h.ToString("00")   + m.ToString("00")  + s.ToString("00");
    }


FR:徐海涛(hunk Xu)

你可能感兴趣的:(Unity)