如何减去DateTime值和获取时间时间、DateTime

由网友(早恋提高情商)分享简介:我的基本意思和具体情况是。What I basically mean and the exact scenario is.您在ASP.NET页2 TimeEdit控制。那些采取DateTime值。现在首重presents你开始工作,当你完成工作的第二个时间。可以采取工时一种有效的方法? You have 2...

我的基本意思和具体情况是。

What I basically mean and the exact scenario is.

您在ASP.NET页2 TimeEdit控制。那些采取DateTime值。 现在首重presents你开始工作,当你完成工作的第二个时间。 可以采取工时一种有效的方法?

You have 2 TimeEdit controls in an ASP.NET page. Those take DateTime values. Now the first represents the time you start working and the second when you finished working. Can take the working hours with an efficient way?

例如。 2011年10月6日09:00 - 2011年10月6日17:00 - > 08:00的工作时间...

e.g. 10/6/2011 09:00 - 10/6/2011 17:00 --> 08:00 working hours...

推荐答案

减去两个的DateTime s给出你一个时间跨度目标:

Subtracting two DateTimes gives you a TimeSpan object:

TimeSpan span = timeEnd - timeStart;
Console.WriteLine("Total work hours: {0}", span.TotalHours);
阅读全文

相关推荐

最新文章