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
 SQL Server Development (2000)
 DATEADD function

Author  Topic 

jim65
Starting Member

35 Posts

Posted - 2006-05-04 : 10:02:29
when I used DataAdd function, like DATEADD (mm , @monthCount, @FYE), I have a FYE is '2/28/06'
I can get date '3/28/06', '4/28/06' ........ How can I get '3/31/06. 4/31/06'.....the month end dates. Thanks

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-04 : 10:08:40

Select dateadd(month,datediff(month,0,getdate())+1,0)-1 as last_day

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-05-04 : 10:29:08
This will find the end of month for any date:

select EOM = dateadd(month,datediff(month,-1,getdate()),-1)

You can also use the F_END_OF_MONTH function on this link:
End Date of Time Period Functions
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=64759

CODO ERGO SUM
Go to Top of Page

jim65
Starting Member

35 Posts

Posted - 2006-05-04 : 10:41:57
Thanks. you guys.
Go to Top of Page
   

- Advertisement -