Addings months to a date

  • 14 August 2015
  • 3 replies
  • 6 views

Badge +1

Hi, 

I have seen addDays, addWeeks, addyear in functions, How can I add months to a specific date.

 

Regards,

-Naveen


3 replies

Userlevel 5
Badge +16

Hi Naveen, 

 

Good question, am not sure why.

 

there are workarounds, but what do you mean by month? 28, 30 or 31 days?

 

you can use the days function with a trick, would this help?

 

15449i44851B0108A0D195.png

 

why don't you just add days(30,60) ? it's the same

Userlevel 1
Badge +8

Hi naveen

 

I had this requirement too, and used a SQL stored procedure to do it using the DATEADD function. You can create a SmartObject from this stored procedure and use it as a generic method to add months.

 

It would be a good feature request.

 

 

Badge +4

Hi Naveen,

The closest I was able to come without using a sproc is the query below, and it is shoddy at best. Perhaps you can take this and push it over the finishline, I only had +- 10 minutes to write this one up for you.
13307iC0010DA27F92F799.png

Now this will push the date forward exactly one month, problems come when it is the 31st of a month, then it will get pushed to the 1st of the 2nd month from that date.

 

Regards and apologies for the shoddy work there :P
Pieter

Reply