For additional fun, consider how this would work with the added constraint of needing the date be a business day, so you need to take into account how weekends (which vary across the world, by the way; in a bunch of countries sunday is a business day but friday is off) and banking holidays in every locale in which you do business.