C#方法总结hh:mm数据???

abm*_*bmv 5 c# time datetime timespan date-math

我想要一个方法,将以hh:mm格式(时间小时和分钟)格式化字符串数据

0:15 + 0:15 = 0:30

Noo*_*ilk 16

将字符串转换为TimeSpans然后调用该.Add方法.

TimeSpan s1 = TimeSpan.Parse("0:15");
TimeSpan s2 = TimeSpan.Parse("0:45");

TimeSpan s3 = s1 + s2;

// not tested; should work.
Run Code Online (Sandbox Code Playgroud)

参考:http://msdn.microsoft.com/en-us/library/system.timespan.aspx