开发者

Substract date value from datetime and get results in seconds, TSQL

I have a table with userID,date and duration ( in seconds ). Each previously used userID updates the table i want t开发者_如何学JAVAo calculate TimeSpan between now and first entrance saved in date column and update duration column.

For example this will select number of seconds in current day but it won't probably work in case when insert made day x while update occurred on day x+1

select (datepart(hh,getdate())*3600)+(datepart(mi,getdate())*60)+(datepart(ss,getdate()))


DATEDIFF(SECONDS, myField, getDate())?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜