要增加从数据库访问的日期 [英] want to increase date that has been accessed from database
问题描述
亲爱的先生,
我有一个数据库表(sql server 2005和asp.net(c#)),其中有一个列存储date,我已经通过sql访问了该日期,现在我想对该访问的日期进行提示并显示在detailview中.(例如,我访问了现在我要在2011年1月1日显示此日期,方法是根据需要显示1或2(显示1的访问日期后应该是2011年2月1日).
请建议我怎么可能.
请帮我.
谢谢
Abhishek
Dear Sir,
I have a database Table(sql server 2005 and asp.net(c#)) In which a column store date , I have accessed that date by sql and now I want to increament that accessed that and display in detailview.(e.g. i have accessed 1/1/2011 now i want to display this date by increamenting 1 or 2 according to need(after increamenting 1 of accessed date it should be 2/1/2011)).
Pls Suggest me how it is possible.
Pls help me out.
Thanks
Abhishek
推荐答案
尝试一下,
在这里,我将找出从今天起两天后的日期,
SELECT CONVERT(VARCHAR(10),GETDATE()+ 2,105)AS日期
-------------------------------------------------- -------------------------------------------------- ----
更新的代码,
要从我的表Table_1中的日期"列检索10天后找出日期,
try this,
Here I will find out the date after 2 days from today,
SELECT CONVERT(VARCHAR(10), GETDATE()+2, 105) AS date
--------------------------------------------------------------------------------------------------------
Updated code,
To findout the date after 10 days retrived from column ''Date'' in my table Table_1,
select CONVERT(VARCHAR(10),dateadd(day,10,Date),105) as date from Table_1 where ID=1
To findout the date after 10 months retrived from column 'Date' in my table Table_1,
select CONVERT(VARCHAR(10),dateadd(month,10,Date),105) as date from Table_1 where ID=1
--------------
@Nidhish
--------------
@Nidhish
这篇关于要增加从数据库访问的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!