How would I find the date of the next given day, given name of day (ex "Wednesday"), from a date (ex 12/9/14) in Java?
For example, how I find the next Wednesday after a date of December 9, 2014.
How would I find the date of the next given day, given name of day (ex "Wednesday"), from a date (ex 12/9/14) in Java?
For example, how I find the next Wednesday after a date of December 9, 2014.
int whichDay= Calendar.WEDNESDAY;
if(cal.get(Calendar.DAY_OF_WEEK)>= whichDay){
cal.add(Calendar.DAY_OF_MONTH, 7);
}
cal.set(Calendar.DAY_OF_WEEK, whichDay);