时间计算 [英] time duartion calculation

查看:109
本文介绍了时间计算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您正在使用sqlserver 2005.我有一个表,其中有5列 Start_time,pause_time,continue_time,pause_duration,end_time和total_duration。当我点击pause_time和continue_time时,时差应该是显示在pause_duration列中,我写了代码。事情就是当我点击pause_time和continue_time时,差异应该被添加到我之前需要做的事情的结果吗?



请帮助...

事先谢谢,

hi am using sqlserver 2005. i hv a table in which 5 columns are there Start_time, pause_time, continue_time, pause_duration, end_time and total_duration. when i clicked on pause_time and continue_time the time difference should be displayed in pause_duration column for that i hv written the code. the thing is when i clicked on pause_time and continue_time the differnce should be added to the previous result for that what i need to do?

pls help...
thankks in advance,

推荐答案

在C#pause_duration + =差异

in SQL Update查询集pause_duration = pause_duration +差异



如果你在SQL中存储暂停时间并在不同的行中继续时间,那么暂停持续时间将是该唯一ID的一部分
in C# pause_duration += difference
in SQL Update query set pause_duration = pause_duration + difference

and if you are storing in SQL the pause time and continue time in different rows then the pause duration will be the some for that unique id


首先计算时差并存储它。然后,当计算新的差异时,只需将其添加到先前的值。



First calculate the time difference and store it. Then when a new difference is calculated just add that to the previous value.

//The first time it is null when initializing.
PauseDuration = null;

//Then every time for calculation
PauseDuration += ContinueTime - PauseTime;


这篇关于时间计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆