I am trying to get the last day of last month as the following string “dd.MM.yyyy” to use it as date filter in excel.
Example: today is 02.06.2020 → I need to get 31.05.2020.
I already tried with the function “daysinmonth”, but unfortunately it didn’t work.
Does anybody have an idea how to do this?
Thank you!
If MyDate is your Date or Datetime datatype variable, you can get the last day in the current month by assigning another Date or Datetime variable to MyDate.AddDays(MyDate.DaysInMonth - MyDate.Day).