Bear Bibeault wrote:Perhaps DAY_OF_WEEK is not the right constant to use? (Hint: it's not.)
Hint: yes it is. An add() using DAY_OF_WEEK has exactly the same effect as an add using DATE, DAY_OF_MONTH, or DAY_OF_YEAR. A get(), set(), or roll() will behave differently, but not add() - the date/time gets adjusted the same way for any of those constants I just listed. We may regard DAY_OF_WEEK as less intuitive to us to use here, but the effect is the same. And of course, for the part of the code that depends on get() above, DAY_OF_WEEK is the correct field to use, since it's code that's trying to skip Saturday and Sunday.
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop