本文介绍了datetime列的总计和小计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
-SA
It is apparent that you obtained string concatenation, and not numeric calculation. Probably you just used '+' operator on strings.
No, please see my comment to the question. Summing up objects of the type System.DateTime makes no sense at all; they represents points on the time axis.
Consider using System.TimeSpan instead. But before calculating the sum, you need to parse the string to this type. Please see all the methods named Parse, ParseExact, TryParse and TryParseExact:
msdn.microsoft/en-us/library/system.timespan_methods%28v=vs.110%29.aspx[^].
—SA
大家好, 我需要在gridview中找到datetime列的总数和小计。 iam使用gridview帮助程序( www.agrinei/gridviewhelper/gridviewhelper_en.htm [ ^ ]) 找到解决方案。它正在为整数值工作 为datetime列,它显示为字符串,例如。 08:30:0005:30:00,我需要结果 是
Hi guys, I need to find the total and subtotal of datetime column in gridview. iam using gridview helper( www.agrinei/gridviewhelper/gridviewhelper_en.htm[^] ) to find the solution.It is working for integer values for datetime column it is displaying as string eg. 08:30:0005:30:00,I need the result to be
1st row -> 08:30:00 2nd row -> 05:30:00 result -> 14:00:00有人可以帮我找到解决方案。 提前致谢。
can anyone please help me to find the solution. Thanks in advance.
推荐答案很明显,您获得了字符串连接,而不是数字计算。可能你只是在字符串上使用'+'运算符。 不,请看我对这个问题的评论。总结 System.DateTime 类型的对象根本就没有意义;它们代表时间轴上的点。 考虑使用 System.TimeSpan 。但在计算总和之前,您需要将字符串解析为此类型。请参阅名为 Parse , ParseExact , TryParse 的所有方法和 TryParseExact : msdn.microsoft/en-us/library/system.timespan_methods%28v=vs.110%29.aspx [ ^ ]。br />
更多推荐
datetime列的总计和小计
发布评论