.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Post New Resource Bookmark and Share   

Add datepart to Existing date in SQL using Dateadd function

Posted By:Hiren Soni       Posted Date: August 29, 2010    Points: 10    Category:    URL: http://www.dotnetspark.com  

Add datepart to Existing date in SQL using Dateadd function
 


Add datepart to Existing date in SQL using Dateadd function


Select dateadd(day,21,existing_date_column)

From table.





Above query add 21 days to existing_date_column and display its result.



You can also add

Year,

quarter,

Month,

dayofyear,

Day,

Week,

Hour,

minute,

second,

millisecond





ex.

Select dateadd(year,1,existing_date_column)

From table.





It will add 1 year in existing_date

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend