@addMonthsToDate() built in function problem

@addMonthsToDate(@CurrentDateTime(), 6) I am using above Built in function to set the date in Calendar to after 6 months. But my problem is It is giving the dae as 2 days less. Supose Today's date is March 6th 2009 and when I call this , calendar should show me September 6th 2009. But it is returning September 4th 2008. Please let me know if any body have same issue. Thanks, Lenin.

***Updated by moderator: Marissa to close post***
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.


Keep up to date on this post and subscribe to comments

March 6, 2009 - 1:48pm

addMonthsToDate, I believe, will give you the same "day of the week" and "week of the month" in the new month.

So, if you call it with today's date and "add 6 months", since today is the first friday of the month, it will give you the first friday of the month in September (Sept 4th 2009).

March 6, 2009 - 1:53pm

Mirat - Is there any alternative solution to get the actual date after 6 months.
Just, I want to get the value as September 6th or September 5th if I add 6 months.

March 6, 2009 - 5:19pm

What date do you want when you add 1 month to Jan 31? Or one month to May 31?

Alternative: On average, months are (365.25/12)= 30.4375 days long --> 30 days, 10 hours, 30 minutes.

To use this approach you should call
AddToDate( ), rather than addMonthsToDate.