更新时间:2023-02-05 20:43:30
获取该字符串并将其转换为TimeSpan字段,然后取出差异。
了解TimeSpan
。您需要找到到时间和从时间之间的差异。使用Timespan,您可以获得小时/分钟/秒等的差异。
参考:
MSDN:TimeSpan结构 [ ^ ]
MSDN:TimeSpan.Parse方法(字符串) [ ^ ]
Take that string and convert it into TimeSpan field and then take the difference.
Read aboutTimeSpan
. You need to find the difference between the to time and the from time. Using Timespan, you get the difference in terms of hours/minutes/seconds, etc.
Refer:
MSDN: TimeSpan Structure[^]
MSDN: TimeSpan.Parse Method (String)[^]