Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding 1 month to a date? 1

Status
Not open for further replies.

RevelationUK

Technical User
Jun 29, 2005
6
GB
In Sql, how do I add exactly 1 month to a date in the format mm/dd/yyyy ?
 
as in, if i have CurrentDate = 1st Feb
and I add "1 month" it will return: 1st March
 
Use dateadd. This will return 1 month from today.
Code:
select convert(varchar(10), dateadd(mm, 1, getdate()), 101)

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(Not quite so old any more.)
 
> In Sql, how do I add exactly 1 month to a date in the format mm/dd/yyyy ?

mrdenny said everything, but I cannot resist: does this mean date is stored as string (char/varchar)?

------
"There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
[banghead]
 
1 month from today

select dateadd(m,+1, getdate())
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top