且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

字符串之间的持续时间为两次

更新时间: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 about TimeSpan. 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)[^]