private String getNextMensNight(PrintWriter out)
{
//Our date will be returned as a string
String result = "";
//Setup a calendar for the next tuesday (forward or back)
GregorianCalendar closestTuesday = new GregorianCalendar();
closestTuesday.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY);
//Setup a calendar to track today
GregorianCalendar today = new GregorianCalendar();
//If the closest tuesday is less than today
if(closestTuesday.get(Calendar.DAY_OF_MONTH) < today.get(Calendar.DAY_OF_MONTH))
{
//Set the closest tuesdays day of month to be +7 (the next tuesday)
closestTuesday.set(Calendar.DAY_OF_MONTH, closestTuesday.get(Calendar.DAY_OF_MONTH) + 7);
}
//Otherwise, the closest tuesday is our next date
result = closestTuesday.get(Calendar.YEAR) + "-" + (closestTuesday.get(Calendar.MONTH) + 1) + "-" + closestTuesday.get(Calendar.DATE);
//Return the formatted date string
return result;
}