Hi everyone,
I am trying to get the specific dates after certain months. For example, if I have a 2018/1/1, after 3 months, I want to get 2018/3/31. I use this: begindate. addmonth(3). adddays(-1). This works fine until I have some interesting dates. Please see the results I tested below. Does anyone know how the dates marked wrong? And how can I solve this? Many thanks!
Begin date End date
2018/1/1 2018/3/31
2018/2/1 2018/4/30
2018/2/28 2018/5/27(Should be 2018/5/30)
2018/3/1 2018/5/31
2018/4/30 2018/7/29(Should be 2018/7/30)
Hi Madhuraj,
thanks for the reply. I am trying to get the date after 3 months, not exactly to be the end of month. For instance, if I have a 2018/1/13, I want to get 2018/3/12. My code works ok until I put in 2018/2/28 and 2018/4/30, which happened to be the end of month. I don’t know if the reason are the different days in months.
Hi Sarathi123,
I am trying to get not only the last day in month, but also the specific days after 3 months. For instance, if I have a 2018/1/13, I want to get 2018/3/12. Mine works for the other days expect for the 2/28, 4/30, which happens to be the last day of each month. any idea on this? many thanks.