Groups | Blog | Home
all groups > sql server (alternate) > august 2003 >

sql server (alternate) : add and subract time to a date


billy_cormic NO[at]SPAM hotmail.com
8/20/2003 11:02:01 AM
Hello all,
Lets say I have the current date and I would like to get the date
two weeks in advance. How would I do this in T-sql? The T-SQL should
take into account if the month changes. For example, if todays date
is 1/17/2003 the advanced date would be 2/17/2003.

Thanks,
Anith Sen
8/20/2003 6:14:06 PM
You can use DATEADD function to accomplish this. Refer to SQL Server Books
Online for more details. For example :

SELECT DATEADD(m, 1, '20030117') ;

--
- Anith
( Please reply to newsgroups only )

AddThis Social Bookmark Button