使用查询如何在sql server中第二天约会 [英] using query how to next day date in the sql server
本文介绍了使用查询如何在sql server中第二天约会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用sql server,在那里使用查询如何在sql server中获取第二天的日期。
如果假设7/4/2013
i想要输出如下8/4/2013。
如何使用sql获得上述输出服务器。
请帮帮我
问候
Narasiman P
i am using sql server, in that using query how to get the next day date in the sql server.
if suppose 7/4/2013
i want the output as follows 8/4/2013.
how can i get the above output using sql server.
Please help me
Regards
Narasiman P
推荐答案
这样做:
Do this:
DATEADD(day, 1 , "your date" )
Solution1(通过richcb)非常好,但我想向你展示一些小技巧。当然,您可以使用 DATEADD [ ^ ]功能,但见下面的例子:
Solution1 (by richcb) is very good, but i want to show you little trick. Of course, you can use DATEADD[^] function, but see below example:
DECLARE @myDate DATETIME
SET DATEFORMAT dmy;
SET @myDate = '07/04/2013'
SELECT @myDate AS MyDate1, DATEADD(dd,1,@myDate) AS MyDate2, @myDate + 1 AS MyDate3
相同您只需使用 + 1
即可实现。
这篇关于使用查询如何在sql server中第二天约会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文