秒转换成时分秒

private String returnFullTimes(int theSecond)
        {
            int h = 0, m = 0, s = 0;

            h = (int)Math.Floor(theSecond / 3600.0);
            if (h > 0)
            {
                m = (int)Math.Floor((theSecond - h * 3600.0) / 60);
                if (m > 0)
                {
                    s = theSecond - h * 3600 - m * 60;
                }
                else
                {
                    s = theSecond - h * 3600;       //原来这里写错了,写成了s   =   theSecond;   
                }
            }
            else
            {
                m = (int)Math.Floor(theSecond / 60.0);
                if (m > 0)
                {
                    s = theSecond - m * 60;
                }
                else
                {
                    s = theSecond;
                }
            }
            return h + "" + m + "" + s + "";
        }
相关文章
相关标签/搜索