时间差异 [英] time difference

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

问题描述

朋友们,

我的数据库中有一个表,其中包含三列:

1. 开始数据类型为datetime
2.数据类型为datetime的 end
3.第三列差异

现在我想要的是差异应该显示天小时分钟秒
中的其他两列的差异


我应该怎么做,以便每当我编写查询从[tableName] 中选择*时,都会显示其他2列的差异.


感谢

Hi friends,

I have a table in database which contains three columns :

1. start with datatype datetime
2. end with datatype datetime
3. and the third column difference,

Now what I want is the difference should show the difference of other two columns in days hours min sec



What should I do so that whenever I write query select * from [tableName] difference show the difference of other 2 column.


thanks

推荐答案

讨论此问题的各种方法
Various ways to do this discussed here[^].

You can choose whichever method suits your requirement.


为什么需要第三列?无法使用 DATEDIFF [
Why do you need the third column? cannot you use the DATEDIFF[^] function in your query?

:)


让我知道,您想获取日期时间或日期天数之间的日期差(如果没有天数).你可以选择
选择DATEDIFF(day,GETDATE(),GETDATE()+ 1)
Let me know that u want to get difference of dates in datetime or no of days.if no of days. u can choose
select DATEDIFF(day,GETDATE(),GETDATE()+1)


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

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