需要获取两个日期之间的差异 [英] need to get the diff between two dates

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

问题描述



我需要获取两个日期之间的差异
例如:-开始日期(2012年10月30日)结束日期(2012年11月1日)

输出= 19/09/2012以及结果日期的总天数.

在此先感谢

Sucharitha

Hi,

i need to get the diff between two dates
Ex:- startdate(30/10/2012) enddate(11/01/2012)

Output= 19/09/2012 and also total days of result date.

Thanks in Advance

Sucharitha

推荐答案

尝试 DATEDIFF [ ^ ]:
Try DATEDIFF[^]:
SELECT DATEDIFF(day, '2011-01-01', '2011-02-01')


请参阅:

http://www.shabdar.org/sql-server/104-sql-server-calculate-delay-difference-between-two-dates.html [
Refer this:

http://www.shabdar.org/sql-server/104-sql-server-calculate-delay-difference-between-two-dates.html[^]


尝试此链接
http://msdn.microsoft.com/en-us/library/ms189794.aspx [ ^ ]
try this link
http://msdn.microsoft.com/en-us/library/ms189794.aspx[^]


这篇关于需要获取两个日期之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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