Today I’m sharing a handy function with you that allows you to retrieve all or just a couple of dates between 2 given dates: Date.DatesBetween.
This function takes 3 parameters:
- From- or Start-date
- To- or End-date
- A selection of ONE of these intervals: Year, Quarter, Month, Week or Day
All dates will be created at the end of the chosen interval: So if you want to analyse events with a duration for example, where you want to transform your data to show one day per (monthly) event, this function generates month-end-dates for every month within the timespan. Please not that if the To-/End-date is within a month, the last element of the list will NOT be that day, but the day of the end of that month.
The default-value for the 3rd parameter is “Day”, so if you omit the specification, the function will return a list of all days in between.