asp.Netint総秒数取得タイムスタンプ

746 ワード

テスト成功
[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;
        }