unity 由总秒数推出时分秒

    xiaoxiao2022-07-04  129

    /// <summary> /// 计算时分秒 /// </summary> /// <param name="time">总共多少秒</param> /// <returns></returns> 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)

    最新回复(0)