I am trying to figure out how to calculate the nearest date after a given date for a repeating period.
For example, if the recurring period is once every two weeks starting January 1, 2016, and the indicated date is January 17, how can I calculate that the next date of the repeating period is January 28?
A recurring period can be any number of days, weeks, months, or years.
Right now, the only solution I can think of is to start from the start date and the loop, adding a recurring period at each iteration until I pass that date, but I wonder if there is a more efficient or elegant solution?
source share