首页 > 代码库 > asp.net int 总秒数 获取时间戳

asp.net int 总秒数 获取时间戳

测试成功

[Test]
        public TimeSpan geTimeSpan(int val)
        {
            var result = new TimeSpan();
            if (val < 60)
            {
                var query = new TimeSpan(0, 0, val);

                result = query;
            }
            if (val < 3600)
            {
                var m = val/60;
                var s = val%60;
                var query = new TimeSpan(0,m,s);

                result = query;
            }
            else
            {
                var h = val/3600;
                var m = val / 60;
                var s = val % 60;
                var query = new TimeSpan(h, m, s);

                result = query;
            }
            return result;
        }



asp.net int 总秒数 获取时间戳