Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 datetime function

Author  Topic 

u2p_inst
Yak Posting Veteran

78 Posts

Posted - 2003-05-10 : 07:35:35
how to add datetime function with month variable
example
2003-01-18 + 3(month) is 2003-04-18

please help me

oh

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2003-05-10 : 08:40:13
quote:

how to add datetime function with month variable
example
2003-01-18 + 3(month) is 2003-04-18

please help me

oh



use dateadd(datepart,number,date)
foreg.
dateadd(m,3,'2003-01-18')

harshal.

Expect the UnExpected
Go to Top of Page

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2003-05-10 : 10:59:36
Make sure this is what you really want because
for example

SELECT dateadd(m,1,'2003-01-31')

gets you 2003-02-28

different months different amount of days.



Go to Top of Page
   

- Advertisement -