Hi
I am using add months builtin function.suppose I am entering 30th Dec 2020 and trying to add 1 month with help of add months built in function.and it returning proper output 30 th January 2021 but when I am passing 28th February 2021 and trying to add 1 month then it is returning 28 th March 2021 but it should be 30th March 2021.is it right behaviour?
Hi Arkyadeep,
If you're goal is to get the last days of every month, you could take the first day of the next month, and subtract one day. So if you have a certain last day, add one day, add one month, then subtract one day, and so on.
If you want to have all 30th of all months except for February, you'll have to come up with a smarter algorithm, that is actually aware of February having 28 or 29 days. You could also try to see if the NewDate function turns 30 February into 28, and use that.
You are adding one month to the result of the previous row. So in your case, you get:
Row 1: 30-11-2020
Row 2: 30-11-2020 + 1 month = 30-12-2020
Row 3: 30-12-2020 + 1 month = 30-01-2021
Row 4: 30-01-2021 + 1 month = 28-02-2021
Row 5: 28-02-2021 + 1 month = 28-03-2021
You can always use the start date from your starting row. So it would be like this:
Row 3: 30-11-2020 + 2 months = 30-01-2021
Row 4: 30-11-2020 + 3 months = 28-02-2021
Row 5: 30-11-2020 + 4 months = 30-03-2021
Regards,João
Yes, March 28th is 1 month later than February 28th.
If you are looking to add 30 days you can use the AddDays built-in functionality.
But the problem I have 30th January and after that I have to add 1 month for every date suppose if u choose 30th January then recurring date will 28th Feb,30th March,30 th April but if I use adddays,30 then I think after january it will generate 2nd March.
So you want to generate dates by adding one month every time and your concern is that after January 30th, you wind up getting February 28th and then you get stuck in March 28th, instead of March 30th, is that it?
If that is the case, I would fix the starting date, let's say January 30th, and then add 1 month in the first iteration, 2 months on the second, and so on, but always to the starting date January 30th. In this case, you don't get stuck in February.
Hope it helps.
Regards,
João
based on date and EMI tenure i have to generate EMI date so if user entered 30th january then it is generating below emi date.but after february it is changing to 28th of every month it should be 30th of every month because user entered 30th of every month.
Yeah, it adds 1 month to the date you chose as start date, and 1 month = 30 days.
To get end of the date I think you should try your own function.
For example,
Hope this help