ke_junjie
2025-06-04 84620534eb627e95811b971a4b552b6a177829bf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using Furion.TaskScheduler;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace iWare.Wms.Application
{
    public class CommonHelper
    {
        /// <summary>
        /// 秒转换
        /// </summary>
        /// <param name="seconds"></param>
        /// <returns></returns>
        public static string GetTimeString(DateTimeOffset? start,DateTimeOffset? end)
        {
            if (start == null || end == null)
            {
                return "0秒";
            }
            if (start > end)
            {
                return "0秒";
            }
            TimeSpan ts = ((DateTimeOffset)end - (DateTimeOffset)start);
            string msg = "";
            if (ts.Days != 0)
            {
                msg += ts.Days + "天";
            }
            if (ts.Hours != 0)
            {
                msg += ts.Hours + "小时";
            }
            if (ts.Minutes != 0)
            {
                msg += ts.Minutes + "分钟";
            }
            if (ts.Seconds != 0)
            {
                msg += ts.Seconds + "秒";
            }
            return msg;
        }
    }
}