Possible Duplicate:
joda time – add weekdays to date
How can I use the Joda library to subtract a certain number of weekdays (i.e. excluding weekends) from a date?
If the input date is Jan 14, 2013 (Monday) and I subtract 1 day, I would like the result to be Jan 11, 2013 (Friday). How can I accomplish this?
There may not be a way to do this directly with the Joda libraries, but you can write your own Java functionality. In the following example, the
subtractWeekdays(d, num)method rolls a datedback by a givennumof weekdays. The output of this example isFri Jan 11 00:00:00 CST 2013as desired.