Congratulations to all monthly winners of May 2013 !!! They have won INR 2900 cash and INR 27497 worth prize.
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 31424 |  Welcome, Guest!   Register  Login
 Home > Forums > ASP.NET > I want to update date ...
Nuwan

I want to update date

Replies: 5 | Posted by: Nuwan on 5/30/2012 | Category: ASP.NET Forums | Views: 289 | Status: [Member] | Points: 10  


Dear All,

I want to update date in sql with asp project.Im using this query
UPDATE FORCAST SET F_DUEDATE = DAY(1) WHERE (F_CONTRACT = 'hpky000190') AND (F_SERIAL BETWEEN '1' AND '10')


But Day update Like this.
Ole Date = 9/18/2008
Updated Date = 1/19/1900 12:00:00 AM

Bt I want to that date updated like 9/19/2008.

Please help me.

Rathnayake


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Gaur1982
Gaur1982  
Posted on: 5/30/2012 3:58:40 AM
Level: Starter | Status: [Member] | Points: 25

Here you want to add one day in the given date so you can use DATEADD funtion of SQL

Syntax : DATEADD (datepart , number , date )

Example : SELECT DATEADD(day, 1, '9/18/2008')

Output : 9/19/2008

Gaurav Agrawal
http://planetofcoders.com/

Nuwan, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

CGN007
CGN007  
Posted on: 5/30/2012 4:44:00 AM
Level: Silver | Status: [Member] | Points: 25

@Gaur1982

Output is 2008-09-19 00:00:00.000

Nuwan, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Gaur1982
Gaur1982  
Posted on: 5/30/2012 5:28:15 AM
Level: Starter | Status: [Member] | Points: 25

yap that's right answer which you want.....

Gaurav Agrawal
http://planetofcoders.com/

Nuwan, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Nuwan
Nuwan  
Posted on: 5/30/2012 5:44:17 AM
Level: Starter | Status: [Member] | Points: 25

yes , its work. But this method date add in day. like my date is 5 i want to update it 10 I want to add 5 day. like 5+5=>10.
Bt i want my days is 5 if i want to update in 10 like 5=>10.
Because I use ajax calender controller in this programme. Please help.


Rathnayake

Nuwan, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Ajay.Kalol
Ajay.Kalol  
Posted on: 5/30/2012 6:03:27 AM
Level: Starter | Status: [Member] | Points: 25

Try this

select convert(varchar,getdate() + 1,101) as 'Day'


Put Your Date Instead of getdate()


Enjoy

http://ajaypatelfromsanthal.blogspot.in

Nuwan, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

Found interesting? Add this to:


 Latest Posts

Write New Post | More ...

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 6/19/2013 7:05:31 AM