在android SQLite数据库中添加时间总和
我有一个数据库,如果用户停止数据库,每五分钟或更短时间标记一次。如何计算时间戳之间的差异之和并将它们相加?
编辑
我有六个不同的时间,间隔五分钟,其中一次距离用户记录的最后记录的自动时间仅 2 分钟:
13:41:33
13: 46:33
13:51:33
13:56:33
14:01:33
14:06:33
14:08:27
现在我想记录时间并添加标记表示距上次记录时间有多少分钟:
13:41:33 = 0 // 将为零,因为这是用户开始计时的位置
13:46:33 = 5
13:51:33 = 5
13:56 :33 = 5
14:01:33 = 5
14:06:33 = 5
14:08:27 = 2
之后我希望我的应用程序采取所有五和二并加起来:
0 +
5 +
5 +
5 +
5 +
5 +
2 =
27 分钟
I have a database that time stamps every five minutes, or less if the user stops the database. How can I take the sum of the difference between the time stamps and add them up?
EDIT
I have six different times all five minutes apart and one time the is, lets say, only 2 minutes from the last logged auto time that have been logged by the user:
13:41:33
13:46:33
13:51:33
13:56:33
14:01:33
14:06:33
14:08:27
now I want to take the times and add a mark that says its how many minutes from the last logged time:
13:41:33 = 0 //will be zero cause that is where the user started timing
13:46:33 = 5
13:51:33 = 5
13:56:33 = 5
14:01:33 = 5
14:06:33 = 5
14:08:27 = 2
After that I want my application to take all the fives and the twos and add them up:
0 +
5 +
5 +
5 +
5 +
5 +
2 =
27 minutes
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在该列上使用 SQL
SUM
函数,它应该会给出结果。您可能应该使用更具体的标签(SQLite、SQL 等)来标记您的问题Use a SQL
SUM
function on that column and it should give you your result. You should probably tag your question with more specific tags (SQLite, SQL, Etc)